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
|
[tox]
envlist = towncrier-check,docs-lint,pre-commit,py{310,311,312,313,314}-cov,coverage-platform
labels =
test = py-cov,coverage
test310 = py310-cov,coverage310
test311 = py311-cov,coverage311
test312 = py312-cov,coverage312
test313 = py313-cov,coverage313
test314 = py314-cov,coverage314
test-fast = py{310,311,312,313,314}-fast
test-platform = py{310,311,312,313,314}-cov,coverage-platform
skip_missing_interpreters = True
[testenv:pre-commit]
package = wheel
wheel_build_env = .pkg
extras = dev
commands = pre-commit run --all-files --show-diff-on-failure --color=always
[testenv:py{,310,311,312,313,314}{,-fast,-cov}]
package = wheel
wheel_build_env = .pkg
depends: pre-commit
use_develop = fast: True
# Needed on Windows to test data directory creation
passenv = LOCALAPPDATA
setenv = COVERAGE_FILE = {env:COVERAGE_FILE:.coverage}
extras = dev
commands =
!fast-!cov : python -X warn_default_encoding -m pytest {posargs:-vv --color yes}
cov : python -X warn_default_encoding -m coverage run -m pytest {posargs:-vv --color yes}
fast : python -m pytest {posargs:-vv --color yes -n auto}
[testenv:coverage{,310,311,312,313,314}{,-ci}{,-platform,-platform-linux,-platform-macos,-platform-windows,-project}{,-keep}{,-html}]
package = wheel
wheel_build_env = .pkg
depends = pre-commit,py{,310,311,312,313,314}{,-cov}
# by default, coverage should run on oldest supported Python for testing platform coverage.
# however, coverage for a particular Python version should match the version used for pytest.
base_python =
coverage: py310,py311,py312,py313,py314
coverage310: py310
coverage311: py311
coverage312: py312
coverage313: py313
coverage314: py314
passenv = COVERAGE_FILE
setenv =
keep: COMBINE_FLAGS = --keep
# spoof platform for conditional coverage exclusions
platform-linux: COVERAGE_PLATFORM = linux
platform-macos: COVERAGE_PLATFORM = darwin
platform-windows: COVERAGE_PLATFORM = win32
# use the coverage files created in CI for individual platforms
ci-platform-linux: COVERAGE_FILE = .coverage.ubuntu
ci-platform-macos: COVERAGE_FILE = .coverage.macos
ci-platform-windows: COVERAGE_FILE = .coverage.windows
# disable conditional coverage exclusions for Python version to test entire platform
{platform,project}: COVERAGE_EXCLUDE_PYTHON_VERSION=disable
# disable conditional coverage exclusions for host platform to test entire project
project: COVERAGE_EXCLUDE_PLATFORM=disable
extras = dev
commands_pre =
python --version
commands =
-python -m coverage combine {env:COMBINE_FLAGS}
html: python -m coverage html --skip-covered --skip-empty
python -m coverage report --fail-under=100
[testenv:towncrier{,-check}]
skip_install = True
deps =
towncrier==24.8.0
commands =
check : python -m towncrier.check --compare-with origin/main
!check : python -m towncrier {posargs}
[docs]
docs_dir = {tox_root}{/}docs
build_dir = {[docs]docs_dir}{/}_build
sphinx_args = --show-traceback --fail-on-warning --keep-going --jobs auto
[testenv:docs{,-lint,-all,-live}]
# Docs are always built on Python 3.12. See also the RTD config and contribution docs.
base_python = py312
# give sphinx-autobuild time to shutdown http server
suicide_timeout = 1
package = wheel
wheel_build_env = .pkg
deps =
# Docs requirements are *mostly* handled by the `docs` extra; but we can't include
# the theme that way, so the theme is installed using a requirements.txt file,
# independent of the docs extra. Ideally, we'd use dependency groups for docs
# dependencies, but RTD doesn't support them yet.
-r {tox_root}/requirements-docs.txt
extras = docs
passenv =
# On macOS Apple Silicon, you need to manually set the location of the PyEnchant
# library:
# export PYENCHANT_LIBRARY_PATH=/opt/homebrew/lib/libenchant-2.2.dylib
PYENCHANT_LIBRARY_PATH
commands =
!lint-!all-!live : python -m sphinx {[docs]sphinx_args} {posargs} --builder html {[docs]docs_dir} {[docs]build_dir}{/}html
lint : python -m sphinx {[docs]sphinx_args} {posargs} --builder spelling {[docs]docs_dir} {[docs]build_dir}{/}spell
lint : python -m sphinx {[docs]sphinx_args} {posargs} --builder linkcheck {[docs]docs_dir} {[docs]build_dir}{/}links
all : python -m sphinx {[docs]sphinx_args} {posargs} --verbose --write-all --fresh-env --builder html {[docs]docs_dir} {[docs]build_dir}{/}html
live : sphinx-autobuild {[docs]sphinx_args} {posargs} --builder html {[docs]docs_dir} {[docs]build_dir}{/}live
|