python-build/tox.ini

109 lines
2.7 KiB
INI
Raw Permalink Normal View History

2023-01-31 15:56:11 +08:00
[tox]
2024-05-07 10:51:59 +08:00
requires =
tox>=4.2
virtualenv>=20.0.34
env_list =
2023-01-31 15:56:11 +08:00
fix
type
docs
path
2024-05-07 10:51:59 +08:00
{py312, py311, py310, py39, py38, py37, pypy39, pypy38, pypy37}{, -min}
2023-01-31 15:56:11 +08:00
skip_missing_interpreters = true
[testenv]
description =
run test suite with {basepython}
2024-05-07 10:51:59 +08:00
extras =
test
pass_env =
2023-01-31 15:56:11 +08:00
LC_ALL
PIP_*
PYTEST_*
TERM
2024-05-07 10:51:59 +08:00
set_env =
2023-01-31 15:56:11 +08:00
COVERAGE_FILE = {toxworkdir}/.coverage.{envname}
PYPY3323BUG = 1
2024-05-07 10:51:59 +08:00
PYTHONWARNDEFAULTENCODING = 1
TEST_STATUS_DIR = {envtmpdir}
2023-01-31 15:56:11 +08:00
commands =
pytest -ra --cov --cov-config pyproject.toml \
--cov-report=html:{envdir}/htmlcov --cov-context=test \
--cov-report=xml:{toxworkdir}/coverage.{envname}.xml {posargs:-n auto}
[testenv:fix]
description = run static analysis and style checks
2024-05-07 10:51:59 +08:00
base_python = python3.9
2023-01-31 15:56:11 +08:00
skip_install = true
deps =
pre-commit>=2
2024-05-07 10:51:59 +08:00
pass_env =
HOMEPATH
PROGRAMDATA
2023-01-31 15:56:11 +08:00
commands =
pre-commit run --all-files --show-diff-on-failure
python -c 'print("hint: run {envdir}/bin/pre-commit install to add checks as pre-commit hook")'
[testenv:type]
description = run type check on code base
2024-05-07 10:51:59 +08:00
extras =
typing
set_env =
PYTHONWARNDEFAULTENCODING =
2023-01-31 15:56:11 +08:00
commands =
mypy
[testenv:docs]
description = build documentations
2024-05-07 10:51:59 +08:00
base_python = python3.10
2023-01-31 15:56:11 +08:00
extras =
docs
commands =
sphinx-build -n docs {envtmpdir} {posargs:-W}
python -c 'print("Documentation available under file://{envtmpdir}/index.html")'
2024-05-07 10:51:59 +08:00
[testenv:path]
description = verify build can run from source (bootstrap)
set_env =
COVERAGE_FILE = {toxworkdir}/.coverage.{envname}
PYTHONPATH = {toxinidir}/src
commands_pre =
python -E -m pip uninstall -y build colorama
[testenv:{py312, py311, py310, py39, py38, py37, pypy37, pypy38, pypy39}-min]
description = check minimum versions required of all dependencies
skip_install = true
commands_pre =
pip install .[test] -c tests/constraints.txt
2023-01-31 15:56:11 +08:00
[testenv:dev]
description = generate a DEV environment
2024-05-07 10:51:59 +08:00
package = editable
2023-01-31 15:56:11 +08:00
deps =
virtualenv>=20.0.34
extras =
doc
test
commands =
python -m pip list --format=columns
python -c 'import sys; print(sys.executable)'
[testenv:coverage]
description = combine coverage from test environments
skip_install = true
deps =
coverage[toml]>=5.1
diff_cover>=3
parallel_show_output = true
2024-05-07 10:51:59 +08:00
pass_env =
DIFF_AGAINST
set_env =
2023-01-31 15:56:11 +08:00
commands =
coverage combine {toxworkdir}
coverage report --skip-covered --show-missing -i
coverage xml -o {toxworkdir}/coverage.xml -i
coverage html -d {toxworkdir}/htmlcov -i
python -m diff_cover.diff_cover_tool --compare-branch {env:DIFF_AGAINST:origin/main} {toxworkdir}/coverage.xml
2024-05-07 10:51:59 +08:00
depends =
path
{py312, py311, py310, py39, py38, py37, pypy39, pypy38, pypy37}{, -min}