-
Notifications
You must be signed in to change notification settings - Fork 11
/
tox.ini
125 lines (121 loc) · 3.71 KB
/
tox.ini
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
# spell-checker:ignore linkcheck basepython changedir envdir envlist envname envsitepackagesdir passenv setenv testenv toxinidir toxworkdir usedevelop doctrees envpython posargs
[tox]
requires =
tox>=4.11.4
envlist =
lint
pkg
docs
py
devel
[testenv]
description =
Run tests
devel: without constrained dependencies
extras =
test
passenv =
CURL_CA_BUNDLE # https proxies, https://github.com/tox-dev/tox/issues/1437
FORCE_COLOR
HOME
NO_COLOR
PYTEST_* # allows developer to define their own preferences
PYTEST_REQPASS # needed for CI
PYTHON* # PYTHONPYCACHEPREFIX, PYTHONIOENCODING, PYTHONBREAKPOINT,...
PY_COLORS
RTD_TOKEN
REQUESTS_CA_BUNDLE # https proxies
SETUPTOOLS_SCM_DEBUG
SSL_CERT_FILE # https proxies
SSH_AUTH_SOCK # may be needed by git when running with progressive
LANG
LC_*
setenv =
COVERAGE_FILE = {envdir}/.coverage.{envname}
; COVERAGE_PROCESS_START={toxinidir}/pyproject.toml
PIP_CONSTRAINT = {toxinidir}/.config/constraints.txt
devel,pkg: PIP_CONSTRAINT = /dev/null
PIP_DISABLE_PIP_VERSION_CHECK = 1
PRE_COMMIT_COLOR = always
FORCE_COLOR = 1
allowlist_externals =
sh
commands_pre =
sh -c "rm -f .coverage* coverage.xml 2>/dev/null || true"
commands =
coverage run -m pytest {posargs}
sh -c "coverage combine -a -q --data-file={envdir}/.coverage {toxworkdir}/*/.coverage.* && coverage xml --data-file={envdir}/.coverage -o {envdir}/coverage.xml --fail-under=0 && coverage report --data-file={envdir}/.coverage"
package = editable
[testenv:lint]
description = Run all linters
# pip compile includes python version in output constraints, so we want to
# be sure that version does not change randomly.
basepython = python3.10
deps =
pre-commit>=2.6.0
setuptools>=65.3.0
pytest>=7.2.0 # to updated schemas
skip_install = true
commands =
{envpython} -m pre_commit run --all-files --show-diff-on-failure {posargs:}
passenv =
{[testenv]passenv}
PRE_COMMIT_HOME
setenv =
{[testenv]setenv}
# avoid messing pre-commit with out own constraints
PIP_CONSTRAINT=
[testenv:deps]
description = Bump all test dependencies
# we reuse the lint environment
envdir = {toxworkdir}/lint
skip_install = true
basepython = python3.10
deps =
{[testenv:lint]deps}
setenv =
# without his upgrade would likely not do anything
PIP_CONSTRAINT = /dev/null
commands =
pre-commit run --all-files --show-diff-on-failure --hook-stage manual lock
# Update pre-commit hooks
pre-commit autoupdate
# We fail if files are modified at the end
git diff --exit-code
[testenv:docs]
description = Builds docs
extras =
docs
setenv =
# Disable colors until markdown-exec supports it:
# https://github.com/pawamoy/markdown-exec/issues/11
NO_COLOR = 1
TERM = dump
skip_install = false
usedevelop = true
commands =
mkdocs build -v -c --strict --site-dir=_readthedocs/html/ {posargs:}
linkchecker -f linkcheckerrc _readthedocs/html/
[testenv:pkg]
description =
Build package, verify metadata, install package and assert behavior when ansible is missing.
deps =
build >= 1.0.3
pip
twine >= 4.0.1
skip_install = true
# Ref: https://twitter.com/di_codes/status/1044358639081975813
commands =
# build wheel and sdist using PEP-517
{envpython} -c 'import os.path, shutil, sys; \
dist_dir = os.path.join("{toxinidir}", "dist"); \
os.path.isdir(dist_dir) or sys.exit(0); \
print("Removing \{!s\} contents...".format(dist_dir), file=sys.stderr); \
shutil.rmtree(dist_dir)'
{envpython} -m build --outdir {toxinidir}/dist/ {toxinidir}
# Validate metadata using twine
twine check --strict {toxinidir}/dist/*
# Install the wheel
sh -c 'python3 -m pip install "mkdocs-ansible[lock] @ file://$(echo {toxinidir}/dist/*.whl)"'
# Uninstall it
python3 -m pip uninstall -y mkdocs-ansible