| 1 |
# tox (https://tox.readthedocs.io/) is a tool for running tests |
| 2 |
# in multiple virtualenvs. This configuration file will run the |
| 3 |
# test suite on all supported python versions. To use it, "pip install tox" |
| 4 |
# and then run "tox" from this directory. |
| 5 |
|
| 6 |
[tox] |
| 7 |
# we use any Python 3 |
| 8 |
envlist = py3,mypy,check_style |
| 9 |
skip_missing_interpreters=true |
| 10 |
|
| 11 |
[testenv] |
| 12 |
deps = |
| 13 |
-r{toxinidir}/test-requirements.txt |
| 14 |
pytest==7.1.2 |
| 15 |
commands= |
| 16 |
pytest |
| 17 |
|
| 18 |
[testenv:mypy] |
| 19 |
description = |
| 20 |
Run type checks. |
| 21 |
skip_install = True |
| 22 |
deps = |
| 23 |
-r{toxinidir}/test-requirements.txt |
| 24 |
mypy==0.960 |
| 25 |
commands= |
| 26 |
mypy sphinx_reredirects |
| 27 |
|
| 28 |
[testenv:check_style] |
| 29 |
description = |
| 30 |
Run style checks. Do not modify files. |
| 31 |
skip_install = True |
| 32 |
deps = |
| 33 |
isort==5.10.1 |
| 34 |
black==22.3.0 |
| 35 |
flake8==4.0.1 |
| 36 |
commands = |
| 37 |
; import order compatible with black formatter |
| 38 |
isort --check-only --diff --profile black sphinx_reredirects tests setup.py |
| 39 |
black --check --diff sphinx_reredirects tests setup.py |
| 40 |
; Make Flake8 linter compatible with Black formatter |
| 41 |
; https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#flake8 |
| 42 |
flake8 --ignore E203 --max-line-length 88 sphinx_reredirects tests setup.py |
| 43 |
|
| 44 |
[testenv:fix_style] |
| 45 |
description = |
| 46 |
Run and fix style (modify files). |
| 47 |
skip_install = True |
| 48 |
deps = |
| 49 |
isort==5.10.1 |
| 50 |
black==22.3.0 |
| 51 |
flake8==4.0.1 |
| 52 |
commands = |
| 53 |
isort --profile black sphinx_reredirects tests setup.py |
| 54 |
black sphinx_reredirects tests setup.py |
| 55 |
flake8 --ignore E203 --max-line-length 88 sphinx_reredirects tests setup.py |
| 56 |
|
| 57 |
[testenv:docs] |
| 58 |
description = Build docs |
| 59 |
skip_install = True |
| 60 |
deps = |
| 61 |
sphinx==5.0.1 |
| 62 |
sphinx_documatt_theme |
| 63 |
commands = |
| 64 |
; -W turn warnings into errors |
| 65 |
; -q be quiet |
| 66 |
sphinx-build -b html -q -W docs public |
| 67 |
|
| 68 |
[testenv:build] |
| 69 |
description = Package and release |
| 70 |
isolated_build = True |
| 71 |
skip_install = True |
| 72 |
deps = |
| 73 |
build==0.8.0 |
| 74 |
allowlist_externals = |
| 75 |
rm |
| 76 |
commands = |
| 77 |
rm -rf dist |
| 78 |
python -m build |
| 79 |
|
| 80 |
[testenv:publish] |
| 81 |
description = |
| 82 |
Publish the package you have been developing to a package index server. |
| 83 |
By default, it uses testpypi. If you really want to publish your package |
| 84 |
to be publicly accessible in PyPI, use the `-- --repository pypi` option. |
| 85 |
skip_install = True |
| 86 |
changedir = {toxinidir} |
| 87 |
passenv = |
| 88 |
TWINE_USERNAME |
| 89 |
TWINE_PASSWORD |
| 90 |
TWINE_REPOSITORY |
| 91 |
deps = twine |
| 92 |
commands = |
| 93 |
python -m twine check dist/* |
| 94 |
python -m twine upload {posargs:--repository {env:TWINE_REPOSITORY:testpypi}} dist/* |