Debian Codegraph @

tox.ini

raw
1 [tox]
2 requires =
3 tox >= 4
4 envlist =
5 linting
6 py310
7 py311
8 py312
9 py313
10 py314
11 py315
12 pypy3
13 py310-{pexpect,xdist,twisted24,twisted25,asynctest,numpy,pluggymain,pylib}
14 doctesting
15 doctesting-coverage
16 plugins
17 py310-freeze
18 docs
19 docs-checklinks
20
21 # checks that 3.11 native ExceptionGroup works with exceptiongroup
22 # not included in CI.
23 py311-exceptiongroup
24
25
26
27 [pkgenv]
28 # NOTE: This section tweaks how Tox manages the PEP 517 build
29 # NOTE: environment where it assembles wheels (editable and regular)
30 # NOTE: for further installing them into regular testenvs.
31 #
32 # NOTE: `[testenv:.pkg]` does not work due to a regression in tox v4.14.1
33 # NOTE: so `[pkgenv]` is being used in place of it.
34 # Refs:
35 # * https://github.com/tox-dev/tox/pull/3237
36 # * https://github.com/tox-dev/tox/issues/3238
37 # * https://github.com/tox-dev/tox/issues/3292
38 # * https://hynek.me/articles/turbo-charge-tox/
39 #
40 # NOTE: The `SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST` environment
41 # NOTE: variable allows enforcing a pre-determined version for use in
42 # NOTE: the wheel being installed into usual testenvs.
43 pass_env =
44 SETUPTOOLS_SCM_PRETEND_VERSION_FOR_PYTEST
45
46
47 [testenv]
48 description =
49 run the tests
50 coverage: collecting coverage
51 exceptiongroup: against `exceptiongroup`
52 nobyte: in no-bytecode mode
53 lsof: with `--lsof` pytest CLI option
54 numpy: against `numpy`
55 pexpect: against `pexpect`
56 pluggymain: against the bleeding edge `pluggy` from Git
57 pylib: against `py` lib
58 twisted24: against the unit test extras with twisted prior to 24.0
59 twisted25: against the unit test extras with twisted 25.0 or later
60 asynctest: against the unit test extras with asynctest
61 xdist: with pytest in parallel mode
62 under `{basepython}`
63 doctesting: including doctests
64 commands =
65 {env:_PYTEST_TOX_COVERAGE_RUN:} pytest {posargs:{env:_PYTEST_TOX_DEFAULT_POSARGS:}}
66 doctesting: {env:_PYTEST_TOX_COVERAGE_RUN:} pytest --doctest-modules {env:_PYTEST_TOX_POSARGS_JUNIT:} --pyargs _pytest
67 coverage: coverage combine
68 coverage: coverage report -m
69 # Run `coverage xml` only on CI.
70 coverage: python -c 'import os; os.environ.get("CI") and os.execlp("coverage", "coverage", "xml")'
71 passenv =
72 COVERAGE_*
73 PYTEST_ADDOPTS
74 TERM
75 CI
76 setenv =
77 _PYTEST_TOX_DEFAULT_POSARGS={env:_PYTEST_TOX_POSARGS_DOCTESTING:} {env:_PYTEST_TOX_POSARGS_JUNIT:} {env:_PYTEST_TOX_POSARGS_LSOF:} {env:_PYTEST_TOX_POSARGS_XDIST:} {env:_PYTEST_FILES:}
78
79 # See https://docs.python.org/3/library/io.html#io-encoding-warning
80 # If we don't enable this, neither can any of our downstream users!
81 # pylib is not PYTHONWARNDEFAULTENCODING clean, so don't set for it.
82 !pylib: PYTHONWARNDEFAULTENCODING=1
83
84 # Configuration to run with coverage similar to CI, e.g.
85 # "tox -e py313-coverage".
86 coverage: _PYTEST_TOX_COVERAGE_RUN=coverage run -m
87
88 doctesting: _PYTEST_TOX_POSARGS_DOCTESTING=doc/en
89
90 # The configurations below are related only to standard unittest support.
91 # Run only tests from test_unittest.py.
92 asynctest: _PYTEST_FILES=testing/test_unittest.py
93 twisted24: _PYTEST_FILES=testing/test_unittest.py
94 twisted25: _PYTEST_FILES=testing/test_unittest.py
95
96 nobyte: PYTHONDONTWRITEBYTECODE=1
97
98 lsof: _PYTEST_TOX_POSARGS_LSOF=--lsof
99
100 xdist: _PYTEST_TOX_POSARGS_XDIST=-n auto
101 extras = dev
102 deps =
103 coverage: coverage>=7.10
104 doctesting: PyYAML
105 exceptiongroup: exceptiongroup>=1.0.0rc8
106 numpy: numpy>=1.19.4
107 pexpect: pexpect>=4.8.0
108 pluggymain: pluggy @ git+https://github.com/pytest-dev/pluggy.git
109 pylib: py>=1.8.2
110 twisted24: twisted<25
111 twisted25: twisted>=25
112 asynctest: asynctest
113 xdist: pytest-xdist>=2.1.0
114 # Can use the same wheel for all environments.
115 package = wheel
116 wheel_build_env = .pkg
117
118 [testenv:linting]
119 description =
120 run pre-commit-defined linters under `{basepython}`
121 skip_install = True
122 deps = pre-commit>=2.9.3
123 commands = pre-commit run --all-files --show-diff-on-failure {posargs:}
124 setenv =
125 # pre-commit and tools it launches are not clean of this warning.
126 PYTHONWARNDEFAULTENCODING=
127
128 [testenv:docs]
129 description =
130 build the documentation site under \
131 `{toxinidir}{/}doc{/}en{/}_build{/}html` with `{basepython}`
132 basepython = python3.14 # Sync with .readthedocs.yaml to get errors.
133 usedevelop = True
134 deps =
135 -r{toxinidir}/doc/en/requirements.txt
136 commands =
137 sphinx-build \
138 -j auto \
139 -W --keep-going \
140 -b html doc/en doc/en/_build/html \
141 {posargs:}
142 setenv =
143 # Sphinx is not clean of this warning.
144 PYTHONWARNDEFAULTENCODING=
145
146 [testenv:docs-checklinks]
147 description =
148 check the links in the documentation with `{basepython}`
149 usedevelop = True
150 changedir = doc/en
151 deps = -r{toxinidir}/doc/en/requirements.txt
152 commands =
153 sphinx-build -W -q --keep-going -b linkcheck . _build
154 setenv =
155 # Sphinx is not clean of this warning.
156 PYTHONWARNDEFAULTENCODING=
157
158 [testenv:regen]
159 description =
160 regenerate documentation examples under `{basepython}`
161 changedir = doc/en
162 deps =
163 PyYAML
164 regendoc>=0.8.1
165 sphinx
166 allowlist_externals =
167 make
168 commands =
169 make regen
170 setenv =
171 # We don't want this warning to reach regen output.
172 PYTHONWARNDEFAULTENCODING=
173 # Remove CI markers: pytest auto-detects those and uses more verbose output, which is undesirable
174 # for the example documentation.
175 CI=
176 BUILD_NUMBER=
177
178 [testenv:plugins]
179 description =
180 run reverse dependency testing against pytest plugins under `{basepython}`
181 # use latest versions of all plugins, including pre-releases
182 pip_pre=true
183 changedir = testing/plugins_integration
184 deps = -rtesting/plugins_integration/requirements.txt
185 allowlist_externals = pip
186 setenv =
187 PYTHONPATH=.
188 commands =
189 pip check
190 pytest bdd_wallet.py
191 pytest --cov=. simple_integration.py
192 pytest --ds=django_settings simple_integration.py
193 pytest --html=simple.html simple_integration.py
194 pytest --reruns 5 simple_integration.py pytest_rerunfailures_integration.py
195 pytest pytest_anyio_integration.py
196 pytest pytest_asyncio_integration.py
197 pytest pytest_mock_integration.py
198 pytest pytest_trio_integration.py
199 pytest pytest_twisted_integration.py
200 pytest simple_integration.py --force-sugar --flakes
201
202 [testenv:py310-freeze]
203 description =
204 test pytest frozen with `pyinstaller` under `{basepython}`
205 changedir = testing/freeze
206 deps =
207 pyinstaller
208 commands =
209 {envpython} create_executable.py
210 {envpython} tox_run.py
211
212 [testenv:release]
213 description = do a release, required posarg of the version number
214 usedevelop = True
215 passenv = *
216 deps =
217 colorama
218 pre-commit>=2.9.3
219 towncrier
220 commands = python scripts/release.py {posargs}
221
222 [testenv:prepare-release-pr]
223 description = prepare a release PR from a manual trigger in GitHub actions
224 usedevelop = {[testenv:release]usedevelop}
225 passenv = {[testenv:release]passenv}
226 deps = {[testenv:release]deps}
227 commands = python scripts/prepare-release-pr.py {posargs}
228
229 [testenv:generate-gh-release-notes]
230 description = generate release notes that can be published as GitHub Release
231 usedevelop = True
232 deps =
233 pypandoc_binary
234 commands = python scripts/generate-gh-release-notes.py {posargs}
235
236 [testenv:update-plugin-list]
237 description = update the plugin list
238 skip_install = True
239 deps =
240 packaging
241 requests
242 tabulate[widechars]
243 tqdm
244 requests-cache
245 platformdirs
246 commands = python scripts/update-plugin-list.py {posargs}