Skip to content

Commit 9bf32e5

Browse files
authored
Switch to pytest and other test dep updates (#114)
2 parents d1cdd5f + 3467a4f commit 9bf32e5

File tree

13 files changed

+60
-104
lines changed

13 files changed

+60
-104
lines changed

.circle/circlerc.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.

.circle/env

Lines changed: 0 additions & 3 deletions
This file was deleted.

.circle/helpers.sh

Lines changed: 0 additions & 48 deletions
This file was deleted.

.github/workflows/lint-and-unit-tests.yml

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,19 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
version:
19+
python-version:
2020
- "3.8"
2121
- "3.9"
2222
- "3.10"
2323
- "3.11"
2424
steps:
25-
- uses: actions/checkout@v3
25+
- name: Checkout repo
26+
uses: actions/checkout@v4
2627

27-
- uses: actions/setup-python@v4
28+
- name: Setup Python
29+
uses: actions/setup-python@v5
2830
with:
29-
python-version: ${{ matrix.version }}
31+
python-version: ${{ matrix.python-version }}
3032

3133
- name: Clone StackStorm/st2 repo
3234
run: |
@@ -39,8 +41,36 @@ jobs:
3941
sudo apt-get -y install python3-virtualenv
4042
make requirements
4143
42-
- name: Run lint and tests (Python ${{ matrix.version }})
44+
- name: Run lint and tests (Python ${{ matrix.python-version }})
4345
run: |
4446
make .lint
4547
make .unit-tests
4648
49+
set_merge_ok:
50+
name: Set Merge OK
51+
if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
52+
needs:
53+
- build-and-test-python
54+
outputs:
55+
merge_ok: ${{ steps.set_merge_ok.outputs.merge_ok }}
56+
runs-on: ubuntu-latest
57+
steps:
58+
- id: set_merge_ok
59+
run: echo 'merge_ok=true' >> ${GITHUB_OUTPUT}
60+
61+
merge_ok:
62+
name: Merge OK
63+
if: always()
64+
needs:
65+
- set_merge_ok
66+
runs-on: ubuntu-latest
67+
steps:
68+
- run: |
69+
merge_ok="${{ needs.set_merge_ok.outputs.merge_ok }}"
70+
if [[ "${merge_ok}" == "true" ]]; then
71+
echo "Merge OK"
72+
exit 0
73+
else
74+
echo "Merge NOT OK"
75+
exit 1
76+
fi

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ unit-tests: requirements .clone_st2_repo .unit-tests
121121
echo "==========================================================="; \
122122
echo "Running unit tests"; \
123123
echo "==========================================================="; \
124-
. $(VIRTUALENV_DIR)/bin/activate; nosetests $(NOSE_OPTS) -s -v tests/unit || exit 1; \
124+
. $(VIRTUALENV_DIR)/bin/activate; pytest tests/unit || exit 1; \
125125

126126
.PHONY: .clone_st2_repo
127127
.clone_st2_repo:

lint-configs/python/.pylintrc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
[MESSAGES CONTROL]
22
# C0111 Missing docstring
33
# I0011 Warning locally suppressed using disable-msg
4-
# I0012 Warning locally suppressed using disable-msg
5-
# W0704 Except doesn't do anything Used when an except clause does nothing but "pass" and there is no "else" clause
6-
# W0142 Used * or * magic* Used when a function or method is called using *args or **kwargs to dispatch arguments.
74
# W0212 Access to a protected member %s of a client class
8-
# W0232 Class has no __init__ method Used when a class has no __init__ method, neither its parent classes.
95
# W0613 Unused argument %r Used when a function or method argument is not used.
106
# W0702 No exception's type specified Used when an except clause doesn't specify exceptions type to catch.
11-
# R0201 Method could be a function
127
# W0614 Unused import XYZ from wildcard import
138
# R0914 Too many local variables
149
# R0912 Too many branches
@@ -18,7 +13,7 @@
1813
# E0211: Method has no argument
1914
# E1128: Assigning to function call which only returns None Used when an assignment is done on a function call but the inferred function returns nothing but None.
2015
# E1129: Context manager ‘%s’ doesn’t implement __enter__ and __exit__. Used when an instance in a with statement doesn’t implement the context manager protocol(__enter__/__exit__).
21-
disable=C0103,C0111,I0011,I0012,W0704,W0142,W0212,W0232,W0613,W0702,R0201,W0614,R0914,R0912,R0915,R0913,R0904,R0801,not-context-manager,assignment-from-none
16+
disable=C0103,C0111,I0011,W0212,W0613,W0702,W0614,R0914,R0912,R0915,R0913,R0904,R0801,not-context-manager,assignment-from-none
2217

2318
[TYPECHECK]
2419
# Note: This modules are manipulated during the runtime so we can't detect all the properties during

setup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,15 @@
2727
version = parse_version_string(INIT_FILE)
2828
install_reqs, dep_links = fetch_requirements(REQUIREMENTS_FILE)
2929

30+
with open("README.md", "r") as fh:
31+
long_description = fh.read()
32+
3033
setup(
3134
name='st2-auth-ldap',
3235
version=version,
3336
description='StackStorm authentication backend for LDAP.',
37+
long_description=long_description,
38+
long_description_content_type="text/markdown",
3439
author='StackStorm, Inc.',
3540
author_email='[email protected]',
3641
url='https://stackstorm.com/',
@@ -46,14 +51,14 @@
4651
"Programming Language :: Python :: 3.11",
4752
'Environment :: Console',
4853
],
54+
python_requires='>=3.8',
4955
platforms=['Any'],
5056
scripts=[],
5157
provides=['st2auth_ldap'],
5258
packages=find_packages(),
5359
include_package_data=True,
5460
install_requires=install_reqs,
5561
dependency_links=dep_links,
56-
test_suite='tests',
5762
entry_points={
5863
'st2auth.backends.backend': [
5964
'ldap = st2auth_ldap.ldap_backend:LDAPAuthenticationBackend',

test-requirements.txt

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
unittest2
2-
tox
3-
mock>=1.0
4-
flake8
5-
st2flake8==0.1.0
6-
nose>=1.3.7
7-
isort>=4.2.5,<5
8-
pylint==2.6.0
9-
pylint-plugin-utils>=0.4
101
coverage
11-
-e git+https://github.com/StackStorm/st2-auth-backend-flat-file.git@master#egg=st2-auth-backend-flat-file
2+
flake8==7.0.0
3+
mock==5.1.0
4+
pylint~=3.1.0
5+
pylint-plugin-utils>=0.4
6+
pytest
7+
st2-auth-backend-flat-file
8+
st2flake8>0.1
9+
tox

tests/integration/test_active_directory.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
# limitations under the License.
1515

1616
import os
17-
import unittest2
17+
import unittest
1818

1919
from st2auth_ldap import ldap_backend
2020

2121

22-
class ActiveDirectoryAuthenticationTest(unittest2.TestCase):
22+
class ActiveDirectoryAuthenticationTest(unittest.TestCase):
2323

2424
@classmethod
2525
def setUpClass(cls):

tests/integration/test_openldap.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
# limitations under the License.
1515

1616
import os
17-
import unittest2
17+
import unittest
1818

1919
from st2auth_ldap import ldap_backend
2020

2121

22-
class OpenLDAPAuthenticationTest(unittest2.TestCase):
22+
class OpenLDAPAuthenticationTest(unittest.TestCase):
2323

2424
@classmethod
2525
def setUpClass(cls):

0 commit comments

Comments
 (0)