1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
|
[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.5
diff_cover>=7.2
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.9
twine>=4.0.2
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:-W}
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.10
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.29
packaging>=21.3
towncrier>=22.8
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
|