Skip to content

Commit 634d6f1

Browse files
committed
pytest
1 parent 54a4dd3 commit 634d6f1

17 files changed

Lines changed: 644 additions & 494 deletions

.github/workflows/release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ jobs:
3131

3232
strategy:
3333
matrix:
34-
python-version: ['3.9']
34+
python-version: ['3.12']
3535

3636
steps:
3737
- name: Checkout code
38-
uses: actions/checkout@v2
38+
uses: actions/checkout@v4
3939

4040
- name: Set up Python ${{ matrix.python-version }}
41-
uses: actions/setup-python@v2
41+
uses: actions/setup-python@v4
4242
with:
4343
python-version: ${{ matrix.python-version }}
4444

4545
- name: Cache pip
46-
uses: actions/cache@v2
46+
uses: actions/cache@v3
4747
with:
4848
path: ~/.cache/pip
4949
key: ${{ runner.os }}-python-${{ matrix.python }}-pip-${{ hashFiles('**/requirements*.txt') }}-git-${{ github.sha }}
@@ -61,7 +61,7 @@ jobs:
6161
python -m pip install -r requirements-dev.txt
6262
6363
- name: Build package
64-
run: python setup.py bdist_wheel sdist
64+
run: python -m build --sdist --wheel
6565

6666
- name: Check package
6767
run: twine check dist/*

.github/workflows/tests.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,25 @@ jobs:
1111
strategy:
1212
matrix:
1313
python:
14-
- "3.6"
15-
- "3.7"
1614
- "3.8"
1715
- "3.9"
16+
- "3.10"
17+
- "3.11"
18+
- "3.12"
1819

1920
runs-on: ubuntu-latest
2021

2122
steps:
2223
- name: Checkout
23-
uses: actions/checkout@v2
24+
uses: actions/checkout@v4
2425

2526
- name: Set up Python
26-
uses: actions/setup-python@v2
27+
uses: actions/setup-python@v4
2728
with:
2829
python-version: ${{ matrix.python }}
2930

3031
- name: Cache pip
31-
uses: actions/cache@v2
32+
uses: actions/cache@v3
3233
with:
3334
path: ~/.cache/pip
3435
key: ${{ runner.os }}-python-${{ matrix.python }}-pip-${{ hashFiles('**/requirements*.txt') }}-git-${{ github.sha }}
@@ -44,9 +45,10 @@ jobs:
4445
python -m pip install --upgrade pip
4546
python -m pip install --upgrade setuptools wheel
4647
python -m pip install -r requirements.txt
48+
python -m pip install pytest
4749
4850
- name: Run tests
49-
run: python setup.py test
51+
run: pytest tests
5052

5153
all_done:
5254
name: Tests done

Makefile

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,37 @@ help:
99
@echo - make clean
1010
@echo - make doc
1111

12+
isort:
13+
isort --profile black securid tests
14+
15+
black: isort
16+
black securid tests
17+
1218
coverage:
13-
python3 -m coverage run --source=securid test.py && python3 -m coverage report -m
19+
pytest --cov --cov-report=term-missing
1420

1521
test:
16-
python3 setup.py test
22+
pytest
1723

1824
typecheck:
1925
mypy --strict --no-warn-unused-ignores securid
2026

2127
lint:
22-
python3 setup.py flake8
28+
flake8 securid.py securid tests
2329

2430
release:
25-
python3 ./setup.py bdist_wheel
31+
python -m build --sdist --wheel
2632
cd docs; $(MAKE) html
2733

2834
clean:
2935
-rm -rf build dist
3036
-rm -rf *.egg-info
37+
-rm -rf bin lib share pyvenv.cfg
38+
39+
venv:
40+
python3 -m virtualenv .
41+
. bin/activate; pip install -Ur requirements.txt
42+
. bin/activate; pip install -Ur requirements-dev.txt
3143

3244
doc:
3345
cd docs; $(MAKE) html

pyproject.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[build-system]
2+
requires = ["setuptools"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[tool.black]
6+
line-length = 132
7+
8+
[tool.isort]
9+
profile = "black"
10+
11+
[tool.pytest.ini_options]
12+
testpaths = ["tests"]
13+
14+
[tool.coverage.run]
15+
source = ["securid"]
16+
17+
[tool.coverage.report]
18+
exclude_lines = [ "# pragma: no cover", "if TYPE_CHECKING:" ]

requirements-dev.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
coverage
1+
black
2+
build
3+
coverage[toml]
24
flake8
5+
isort
36
mypy
7+
pytest
8+
pytest-cov
9+
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
410
sphinx
5-
tox
6-
black
711
twine<3.4
8-
black
9-
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability

setup.cfg

Lines changed: 65 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,68 @@
1+
[metadata]
2+
name = securid
3+
version = attr: securid.__init__.__version__
4+
keywords = securid, otp
5+
description = Python RSA SecurID 128-bit compatible library
6+
author = Andrea Bonomi
7+
author_email = andrea.bonomi@gmail.com
8+
url = http://github.com/andreax79/python-securid
9+
long_description = python-securid is a Python library for generating RSA SecurID 128-bit compatible token codes
10+
license = MIT
11+
license_files = LICENSE
12+
platforms = any
13+
classifiers =
14+
Development Status :: 5 - Production/Stable
15+
Environment :: Console
16+
Intended Audience :: Developers
17+
License :: OSI Approved :: MIT License
18+
Operating System :: OS Independent
19+
Programming Language :: Python
20+
Topic :: Utilities
21+
Topic :: Software Development :: Libraries :: Python Modules
22+
Programming Language :: Python :: 3.5
23+
Programming Language :: Python :: 3.6
24+
Programming Language :: Python :: 3.7
25+
Programming Language :: Python :: 3.8
26+
Programming Language :: Python :: 3.9
27+
Programming Language :: Python :: 3.10
28+
Programming Language :: Python :: 3.11
29+
Programming Language :: Python :: 3.12
30+
project_urls =
31+
Bug Tracker = http://github.com/andreax79/python-securid/issues
32+
Source Code = http://github.com/andreax79/python-securid
33+
34+
[options]
35+
zip_safe = True
36+
include_package_data = True
37+
python_requires = >=3.5
38+
packages = find:
39+
install_requires =
40+
cryptography>=36
41+
42+
[options.packages.find]
43+
include = securid*
44+
exclude =
45+
ez_setup
46+
examples
47+
tests
48+
49+
[options.extras_require]
50+
test = pytest
51+
52+
[options.entry_points]
53+
console_scripts =
54+
securid = securid.cli:main
55+
56+
[aliases]
57+
test = pytest
58+
159
[bdist_wheel]
2-
universal=1
60+
universal = 1
361

462
[flake8]
5-
max-line-length=120
6-
ignore: W503, E203
63+
max-line-length = 132
64+
extend-ignore =
65+
E203
66+
E401
67+
W504
68+
E221

setup.py

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,5 @@
11
#!/usr/bin/env python
2-
import os
3-
from setuptools import setup, find_packages
4-
from securid import __version__
2+
import setuptools
53

6-
install_requires = [
7-
line.rstrip()
8-
for line in open(os.path.join(os.path.dirname(__file__), 'requirements.txt'))
9-
]
10-
11-
setup(
12-
name='securid',
13-
version=__version__,
14-
description='Python RSA SecurID 128-bit compatible library',
15-
long_description='python-securid is a Python library for generating RSA SecurID 128-bit compatible token codes.',
16-
classifiers=[
17-
'Operating System :: OS Independent',
18-
'Programming Language :: Python',
19-
'Topic :: Software Development :: Libraries :: Python Modules',
20-
'Programming Language :: Python :: 3.5',
21-
'Programming Language :: Python :: 3.6',
22-
'Programming Language :: Python :: 3.7',
23-
'Programming Language :: Python :: 3.8',
24-
'Programming Language :: Python :: 3.9',
25-
],
26-
keywords='securid otp',
27-
author='Andrea Bonomi',
28-
author_email='andrea.bonomi@gmail.com',
29-
url='http://github.com/andreax79/python-securid',
30-
license='MIT',
31-
packages=find_packages(exclude=['ez_setup', 'examples']),
32-
include_package_data=True,
33-
zip_safe=True,
34-
install_requires=install_requires,
35-
entry_points={
36-
'console_scripts': [
37-
'securid=securid.cli:main',
38-
],
39-
},
40-
test_suite='test',
41-
tests_require=['nose'],
42-
)
4+
if __name__ == "__main__":
5+
setuptools.setup()

0 commit comments

Comments
 (0)