-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
tox.ini
186 lines (176 loc) · 4.52 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
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
[tox]
envlist =
lint
docs
pkg
py
lower
integration
minversion = 4.15.1
isolated_build = true
skip_missing_interpreters = true
requires =
tox >= 4.15.1
tox-extra
tox-uv
setuptools >= 65.3.0 # editable installs
pip >= 24.0
[testenv]
description = Run the tests with pytest
extras =
test
commands_pre =
sh -c "rm -f {envdir}/.coverage* 2>/dev/null || true"
commands =
coverage run -m pytest {posargs:\
-ra \
--showlocals \
--doctest-modules \
--durations=10 \
-m "not eco" \
}
{py,py39,py310,py311,py312,py313}: sh -c "coverage combine -a -q --data-file={envdir}/.coverage {envdir}/.coverage.* && coverage xml --data-file={envdir}/.coverage -o {envdir}/coverage.xml --fail-under=0 && coverage report --data-file={envdir}/.coverage"
passenv =
CURL_CA_BUNDLE # https proxies, https://github.com/tox-dev/tox/issues/1437
FORCE_COLOR
GH_*
GITHUB_*
HOME
LANG
LC_*
NO_COLOR
PYTEST_*
PYTEST_* # allows developer to define their own preferences
PYTEST_REQPASS # needed for CI
PYTHON* # PYTHONPYCACHEPREFIX, PYTHONIOENCODING, PYTHONBREAKPOINT,...
PYTHONHTTPSVERIFY
REQUESTS_CA_BUNDLE
SETUPTOOLS_SCM_DEBUG
SHELL
SSH_AUTH_SOCK
SSL_CERT_FILE
TERM
TMPDIR
http_proxy
https_proxy
no_proxy
setenv =
COVERAGE_FILE = {env:COVERAGE_FILE:{envdir}/.coverage.{envname}}
COVERAGE_PROCESS_START={toxinidir}/pyproject.toml
FORCE_COLOR = 1
# To ensure test execution is not affected by user config.
MK_CONFIG_FILE = /dev/null
PIP_CONSTRAINT = {toxinidir}/.config/constraints.txt
PIP_DISABLE_PIP_VERSION_CHECK = 1
PRE_COMMIT_COLOR = always
PYTHONHASHSEED = 0
VIRTUALENV_NO_DOWNLOAD = 1
devel,lint,py{310,311,312,313},pkg,pre: PIP_CONSTRAINT = /dev/null
allowlist_externals =
bash
find
rm
sh
package = editable
[testenv:lower]
description = Install using lower-constraints.txt file for testing oldest versions.
setenv =
PIP_CONSTRAINT = {toxinidir}/.github/lower-constraints.txt
commands_post =
pip --version
pip check
pip freeze
[testenv:deps]
description = Update dependency lock files
skip_install = true
deps =
{[testenv:lint]deps}
setenv =
PIP_CONSTRAINT=
commands =
pre-commit run --all-files --show-diff-on-failure --hook-stage manual deps
[testenv:docs,py{310,311,312,313}-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 =
sh -c "cd docs && mk changelog"
mkdocs build {posargs:}
white_list_externals =
sh
[testenv:lint,py{310,311,312,313}-lint]
description = Run linters
passenv = {[testenv]passenv}
# without PROGRAMDATA cloning using git for Windows will fail with an
# `error setting certificate verify locations` error
PROGRAMDATA
deps =
pre-commit >= 2.4.0
pre-commit-uv
# `usedevelop = true` overrides `skip_install` instruction, it's unwanted
usedevelop = false
# don't install package itself in this env
skip_install = true
setenv =
PIP_CONSTRAINT=
commands =
pre-commit run {tty:--color=always} --all-files --show-diff-on-failure
[testenv:integration]
description = Run integrations tests
setenv =
ANSIBLE_FORCE_COLOR = 1
ANSIBLE_NOCOWS = 1
MK_CONFIG_FILE = /dev/null
extras =
test
deps =
ansible-core>=2.15
nox>=2024.3
commands =
ansible --version
nox --version
mk test-integration
package = editable
[testenv:pkg]
description =
Build package, verify metadata, install package and assert behavior when ansible is missing.
deps =
build >= 0.9.0
twine >= 4.0.1
commands_pre =
commands =
rm -rfv {toxinidir}/dist/
python3 -m build --sdist --wheel --outdir {toxinidir}/dist/ {toxinidir}
# metadata validation
python3 -m twine check --strict {toxinidir}/dist/*
[testenv:clean]
description = Remove temporary files
skip_install = true
deps =
commands_pre =
commands_post =
commands =
find . -type d \( -name __pycache__ -o -name .mypy_cache \) -delete
find . -type f \( -name '*.py[co]' -o -name ".coverage*" -o -name coverage.xml \) -delete
[testenv:coverage]
description = Combines and displays coverage results
skip_install = true
usedevelop = false
setenv =
COVERAGE_PROCESS_START={toxinidir}/pyproject.toml
commands_pre =
commands =
python3 -m coverage --version
# needed by codecov github actions, also ignored result to reach report one.
python3 -m coverage xml --fail-under=0
# just for humans running it:
python3 -m coverage report
deps =
coverage[toml]>=7.0.5