Last active
March 14, 2024 09:56
-
-
Save izikeros/1a2243e083d083c2a4f97cf9c19648d9 to your computer and use it in GitHub Desktop.
[tox configuration] with black, flake8, mypy, pytest, coverage for the project with code in "src" and "tests" directories #tox #project #python #configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [tox] | |
| envlist = black,flake8,mypy,pytest,coverage | |
| skipsdist = true | |
| ; tox_pip_extensions was reported to fix the issue with wrong calculation of pytest coverage | |
| ; Run --recreate before running tox every time | |
| ;$ tox --recreate && tox | |
| ; https://stackoverflow.com/a/46968274/3247880 | |
| ;tox_pip_extensions_ext_venv_update = true | |
| [testenv] | |
| basepython = python3.9 | |
| [testenv:coverage] | |
| ; it requires 'setup.py' or 'pyproject.toml' to have package installable. | |
| deps = -rrequirements.txt | |
| . | |
| pytest-coverage | |
| ; usedevelop - fix problems with 0% coverage https://stackoverflow.com/a/69462954/3247880 | |
| usedevelop=True | |
| commands = | |
| pytest --cov src/ -ra --tb=short --cov-report html --cov-fail-under=70 tests/ | |
| [testenv:flake8] | |
| deps = | |
| flake8==4.0.1 | |
| flake8-bugbear==21.11.29 | |
| flake8-docstrings==1.6.0 | |
| flake8-bandit==2.1.2 | |
| commands = | |
| flake8 ./src --max-line-length=130 --exclude .git,__pycache__,.venv,tmp/cache | |
| flake8 ./tests --max-line-length=130 --exclude .git,__pycache__,.venv,tmp/cache | |
| [testenv:mypy] | |
| deps = | |
| mypy | |
| data-science-types | |
| commands = mypy --config-file mypy.ini --disallow-untyped-defs src | |
| [testenv:black] | |
| deps = black | |
| commands = | |
| black src | |
| black tests |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment