virtualenv/tox.ini
Bernát Gábor fd064dc08f
Bump dependencies and build tools (#2394)
Signed-off-by: Bernát Gábor <gaborjbernat@gmail.com>
2022-08-04 01:39:15 -07:00

168 lines
4.2 KiB
INI

[tox]
envlist =
fix_lint
py311
py310
py39
py38
py37
py36
pypy3
coverage
readme
docs
isolated_build = true
skip_missing_interpreters = true
minversion = 3.14
[testenv]
description = run tests with {basepython}
passenv =
CI_RUN
HOME
PIP_*
PYTEST_*
TERM
setenv =
COVERAGE_FILE = {toxworkdir}/.coverage.{envname}
COVERAGE_PROCESS_START = {toxinidir}/.coveragerc
PYTHONIOENCODING = utf-8
_COVERAGE_SRC = {envsitepackagesdir}/virtualenv
{upgrade}: PYTHONWARNINGS = ignore:DEPRECATION::pip._internal.cli.base_command
extras =
testing
commands =
python -m coverage erase
python -m coverage run -m pytest {tty:--color=yes} \
--junitxml {toxworkdir}/junit.{envname}.xml \
{posargs:tests --int --timeout 600}
python -m coverage combine
python -m coverage report --skip-covered --show-missing
python -m coverage xml -o {toxworkdir}/coverage.{envname}.xml
python -m coverage html -d {envtmpdir}/htmlcov --show-contexts \
--title virtualenv-{envname}-coverage
install_command = python -m pip install {opts} {packages} --disable-pip-version-check
package = wheel
wheel_build_env = .pkg
[testenv:fix_lint]
description = format the code base to adhere to our styles, and complain about what we cannot do automatically
passenv =
*
basepython = python3.10
skip_install = true
deps =
pre-commit>=2.20
commands =
pre-commit run --all-files --show-diff-on-failure
python -c 'import pathlib; print("hint: run \{\} install to add checks as pre-commit hook".format(pathlib.Path(r"{envdir}") / "bin" / "pre-commit"))'
[testenv:coverage]
description = [run locally after tests]: combine coverage data and create report;
generates a diff coverage against origin/main (can be changed by setting DIFF_AGAINST env var)
passenv =
DIFF_AGAINST
setenv =
COVERAGE_FILE = {toxworkdir}/.coverage
skip_install = true
deps =
coverage>=6.4.2
diff_cover>=6.5.1
extras =
parallel_show_output = true
commands =
python -m coverage combine
python -m coverage report --skip-covered --show-missing
python -m coverage xml -o {toxworkdir}/coverage.xml
python -m coverage html -d {toxworkdir}/htmlcov
python -m diff_cover.diff_cover_tool --compare-branch {env:DIFF_AGAINST:origin/main} {toxworkdir}/coverage.xml
depends =
py311
py310
py39
py38
py37
py36
pypy
pypy3
[testenv:readme]
description = check that the long description is valid (need for PyPI)
skip_install = true
deps =
build>=0.8
twine>=4.0.1
extras =
commands =
python -m build -o {envtmpdir} --wheel --sdist .
twine check {envtmpdir}/*
[testenv:docs]
description = build documentation
basepython = python3.10
extras =
docs
commands =
python -c 'import glob; import subprocess; subprocess.call(["proselint"] + glob.glob("docs/*.rst") + glob.glob("docs/**/*.rst"))'
sphinx-build -d "{envtmpdir}/doctree" docs "{toxworkdir}/docs_out" --color -b html {posargs}
python -c 'import pathlib; print("documentation available under file://\{0\}".format(pathlib.Path(r"{toxworkdir}") / "docs_out" / "index.html"))'
[testenv:upgrade]
description = upgrade pip/wheels/setuptools to latest
passenv =
UPGRADE_ADVISORY
skip_install = true
deps =
black>=22.6
changedir = {toxinidir}/tasks
commands =
python upgrade_wheels.py
[testenv:release]
description = do a release, required posarg of the version number
passenv =
*
basepython = python3.10
deps =
gitpython>=3.1.27
packaging>=21.3
towncrier>=21.9
changedir = {toxinidir}/tasks
commands =
python release.py --version {posargs}
[testenv:dev]
description = generate a DEV environment
usedevelop = true
deps =
{[testenv:release]deps}
setuptools_scm[toml]>=7.0.5
extras =
docs
testing
commands =
python -m pip list --format=columns
python -c 'import sys; print(sys.executable)'
[testenv:zipapp]
description = generate a zipapp
skip_install = true
deps =
packaging>=21.3
commands =
python tasks/make_zipapp.py
[isort]
profile = black
line_length = 120
known_first_party = virtualenv
[flake8]
max-complexity = 22
max-line-length = 120
noqa-require-code = true
dictionaries = en_US,python,technical,django
ignore = E203, W503, C901, E402
[pep8]
max-line-length = 120