forked from twisted/twisted
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
186 lines (151 loc) · 5.95 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 configuration file for running tests.
;
; The main trial based environments are defined based on a set of factors. Each
; factor will trigger a different behavior. Multiple factors can be set for the
; same environment:
;
; * alldeps - install all possible dependencies.
; * nodeps - avoid installing any dependencies apart from testing tools.
; * withcov - run the tests wrapped using the coverage.
; * nocov - run the tests directly, without using the coverage wrapper.
; * release-prepare - build the sdist and wheel distribution and run tests for them
; * posix - prepare the tests to be run in a Linux/Unix/macOS environment.
; * macos - prepare the tests to be run in a macOS 10.11+ environment (superset of posix)
; * windows - prepare the tests to be executed under Windows.
;
; See README.rst for example tox commands.
;
[tox]
minversion=3.21.4
requires=
virtualenv>=20.4.2
tox-wheel>=0.6.0
skip_missing_interpreters=True
envlist=lint, mypy,
apidocs, narrativedocs, newsfragment,
release-prepare,
alldeps-nocov
isolated_build=true
[default]
; Files and directories that contain Python source for linting.
sources = setup.py src/ docs/conch/examples docs/mail/examples docs/names/examples docs/pair/examples docs/web/examples docs/words/examples
; These examples fail lint, see https://twistedmatrix.com/trac/ticket/9952
; docs/core/examples
[testenv]
# Wheel based testing is required as part of our release process.
# If you remove the wheels from here, then also update the release
# process to generate its own wheels.
wheel = True
parallel_show_output = True
;; dependencies managed by extras in setup.cfg
extras =
; The "nodeps" build still depends on PyHamcrest.
nodeps: test
; We also need to include `dev_release` so that we can test our
; release helpers or documentation generation.
alldeps: all_non_platform, dev_release
windows: windows_platform
alldeps-macos: osx_platform
serial: serial
{withcov}: dev
;; dependencies that are not specified as extras
deps =
lint: pre-commit
; All environment variables are passed.
passenv = *
setenv =
; Enable sub-processes coverage reports and store coverage reports in a
; known location.
COVERAGE_PROCESS_START = {toxinidir}/.coveragerc
COVERAGE_FILE = {toxinidir}/.coverage
# Help tests know where the base directory is.
TOX_INI_DIR = {toxinidir}
; If serial or windows extras, force serial testing
{windows,serial}: TWISTED_FORCE_SERIAL_TESTS = 1
skip_install =
lint: True
commands =
;
; Display information about Python interpreter
; which will be used in subsequent steps
;
python {toxinidir}/admin/dump_all_version_info.py
posix: python -c "print('Running on POSIX (no special dependencies)')"
; Run tests without wrapping them using coverage.
nocov: python -m twisted.trial --temp-directory={envtmpdir}/_trial_temp --reactor={env:TWISTED_REACTOR:default} --reporter={env:TRIAL_REPORTER:verbose} {env:TRIAL_ARGS:} {posargs:twisted}
; Run the tests wrapped using coverage.
withcov: python {toxinidir}/admin/_copy.py {toxinidir}/admin/zz_coverage.pth {envsitepackagesdir}/zz_coverage.pth
withcov: coverage erase
withcov: coverage run -p --rcfile={toxinidir}/.coveragerc -m twisted.trial --temp-directory={envtmpdir}/_trial_temp --reactor={env:TWISTED_REACTOR:default} --reporter={env:TRIAL_REPORTER:verbose} {env:TRIAL_ARGS:} {posargs:twisted}
lint: pre-commit {posargs:run --all-files --show-diff-on-failure}
newsfragment: python {toxinidir}/bin/admin/check-newsfragment "{toxinidir}"
[testenv:towncrier]
description = Create the release notes from the current fragment files found in the source tree.
; towncrier needs Twisted install to get the version
; and dev_release requires the towncrier package.
extras =
dev_release
commands =
towncrier --yes
#
# `narrativedocs` environment is designed to build the complete documentation HTML files.
#
# It tries to run as close as possible to the Read The Docs environment, as
# that is the environment we use for the release.
#
[testenv:narrativedocs]
description = Build the full documentation (narrative and apidocs).
; Documentation needs Twisted install to get the version.
extras =
dev_release
; It looks like tox don't recognize this a deps script.
allowlist_externals = sphinx-build
setenv =
# Set this to `True` to run similar to Read The Docs.
READTHEDOCS=False
READTHEDOCS_LANGUAGE=en
READTHEDOCS_VERSION=1.0.0.dev0
commands =
sphinx-build -aW -b html -d {toxinidir}/docs/_build {toxinidir}/docs {toxinidir}/docs/_build/
#
# `apidocs` environment is designed to build only the API doc HTML files.
#
# This is here to help during the development process and debugging.
# It is not used for the release.
#
# API docs build violation are visible to stdout.
#
# The resulting files can be viewed with web browsers from the local `apidocs`
# path.
[testenv:apidocs]
description = Build the API documentation.
extras = dev_release
commands = {toxinidir}/bin/admin/build-apidocs {toxinidir}/src/ apidocs
[testenv:mypy]
description = run Mypy (static type checker)
extras = mypy
# https://github.com/twisted/incremental/pull/69
deps = incremental @ https://github.com/twisted/incremental/archive/refs/heads/trunk.tar.gz
commands =
mypy \
--cache-dir="{toxworkdir}/mypy_cache" \
{tty:--pretty:} \
{posargs:src}
;
; Create sdist and wheel packages and run basic tests on them.
; Makes the packages available in root `dist/` directory.
;
[testenv:release-prepare]
deps =
pep517
twine
check-manifest>=0.44
whitelist_externals =
cp
rm
commands =
check-manifest --ignore "docs/_build/**,docs/historic/**,admin/**,bin/admin/**"
rm -rf {toxinidir}/dist
cp -r {distdir} {toxinidir}/dist # copy the wheel built by tox-wheel
{envpython} -m pep517.build --source --out-dir={toxinidir}/dist {toxinidir}
twine check {toxinidir}/dist/*.*