File: tox.ini

package info (click to toggle)
python-klein 24.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,012 kB
  • sloc: python: 6,371; makefile: 130
file content (302 lines) | stat: -rw-r--r-- 6,208 bytes parent folder | download
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
[tox]

envlist =
    lint, mypy
    coverage-py{38,39,310,311,312,py3}-tw{212,221,238,trunk}
    coverage-py37-tw{212,221,238}
    coverage_report
    docs, docs-linkcheck
    packaging

skip_missing_interpreters = {tty:True:False}


[default]

basepython = python3.11

deps =
    tw212: Twisted==21.2.0
    tw221: Twisted==22.1.0
    twcurrent: Twisted
    # See https://github.com/twisted/klein/issues/486
    twtrunk: --use-deprecated=legacy-resolver
    twtrunk: https://github.com/twisted/twisted/tarball/trunk#egg=Twisted

    -r requirements/tox-pin-base.txt
    {test,coverage}: -r requirements/tox-tests.txt

    coverage: {[testenv:coverage_report]deps}

setenv =
    PY_MODULE=klein

    PYTHONPYCACHEPREFIX={envtmpdir}/pycache


##
# Default environment: unit tests
##

[testenv]

description = run tests

basepython =
    py: python

    py37: python3.7
    py38: python3.8
    py39: python3.9
    py310: python3.10
    py311: python3.11
    py312: python3.12
    pypy3: pypy3
    pypy38: pypy3.8
    pypy39: pypy3.9

deps = {[default]deps}

setenv =
    {[default]setenv}

    coverage: COVERAGE_FILE={toxworkdir}/coverage.{envname}
    coverage: COVERAGE_PROCESS_START={toxinidir}/.coveragerc

    TRIAL_ARGS={env:TRIAL_ARGS:}

commands =
    # Run trial without coverage
    test: python -b "{envdir}/bin/trial" --random=0 {env:TRIAL_ARGS} --temp-directory="{envlogdir}/trial.d" {posargs:{env:PY_MODULE}}

    # Run trial with coverage
    # Notes:
    #  - Because we run tests in parallel, which uses multiple subprocesses,
    #      we need to drop in a .pth file that causes coverage to start when
    #      Python starts. See:
    #      https://coverage.readthedocs.io/en/coverage-5.5/subprocess.html
    #  - We use coverage in parallel mode, then combine here to get the results
    #      to get a unified result for the current test environment.
    #  - Use `tox -e coverage_report` to generate a report for all environments.
    coverage: python -c 'f=open("{envsitepackagesdir}/zz_coverage.pth", "w"); f.write("import coverage; coverage.process_startup()\n")'
    coverage: coverage erase
    coverage: python -b -m coverage run --source="{env:PY_MODULE}" "{envdir}/bin/trial" --random=0 {env:TRIAL_ARGS} --temp-directory="{envlogdir}/trial.d" {posargs:{env:PY_MODULE}}
    coverage: coverage combine
    coverage: coverage xml

    # Run coverage reports, ignore exit status
    coverage: - coverage report --skip-covered


##
# Lint
##

[testenv:lint]

description = run all linters

basepython = {[default]basepython}

usedevelop = true
skip_install = True

deps =
    -r requirements/pre-commit.txt

commands =
    pre-commit run {posargs:--all-files}


##
# Mypy static type checking
##

[testenv:mypy]

description = run Mypy (static type checker)

basepython = {[default]basepython}

usedevelop = true

deps =
    -r requirements/mypy.txt
    {[default]deps}

commands =
    mypy                                       \
        --cache-dir="{toxworkdir}/mypy_cache"  \
        {tty:--pretty:}                        \
        {posargs:release.py setup.py src}


##
# Coverage report
##

[testenv:coverage_report]

description = generate coverage report

depends =
    coverage-py{37,38,39,310,311,312,py3}-tw{1,2}{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}
    coverage-py{37,38,39,310,311,312,py3}-tw{current,trunk}

basepython = {[default]basepython}

skip_install = True

deps =
    -r requirements/coverage.txt

setenv =
    {[default]setenv}

    COVERAGE_FILE={toxworkdir}/coverage

commands =
    coverage combine
    - coverage report
    - coverage html


##
# Documentation
##

[testenv:docs]

description = build documentation

basepython = {[default]basepython}

deps =
    -r requirements/sphinx.txt

commands =
    sphinx-build                           \
        -b html -d "{envtmpdir}/doctrees"  \
        "{toxinidir}/docs"                 \
        "{toxinidir}/htmldocs"


[testenv:docs-auto]

description = build documentation and rebuild automatically

basepython = {[default]basepython}

deps =
    {[testenv:docs]deps}
    -r requirements/docs-auto.txt

commands =
    sphinx-autobuild                       \
        -b html -d "{envtmpdir}/doctrees"  \
        --host=localhost                   \
        "{toxinidir}/docs"                 \
        "{toxinidir}/htmldocs"


[testenv:apidocs]

basepython = {[testenv:docs]basepython}

deps =
    pydoctor>=20.12.1

commands =
    pydoctor                                               \
        --project-name=klein                               \
        --project-url="https://github.com/twisted/klein/"  \
        --project-base-dir="{toxinidir}"                   \
        --add-package="{toxinidir}/src/klein"              \
        --html-output="{toxinidir}/apidocs"                \
        --make-html


##
# Check for broken links in documentation
##

[testenv:docs-linkcheck]

description = check for broken links in documentation

basepython = {[testenv:docs]basepython}

deps =
    {[testenv:docs]deps}

commands =
    sphinx-build -b html -d "{envtmpdir}/doctrees" docs docs/_build/html
    sphinx-build -b linkcheck docs docs/_build/html


##
# Packaging
##

[testenv:packaging]

description = check for potential packaging problems

depends =
    coverage-py{37,38,39,310,311,py3}-tw{1,2}{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}
    coverage-py{37,38,39,310,311,py3}-tw{current,trunk}

basepython = {[default]basepython}

skip_install = True

deps =
    -r requirements/packaging.txt

commands =
   pip wheel --wheel-dir "{envtmpdir}/dist" --no-deps {toxinidir}
   twine check "{envtmpdir}/dist/"*


##
# Print dependencies
##

[testenv:dependencies]

description = print dependencies

basepython = {[default]basepython}

recreate = true

deps =
    pipdeptree

commands =
    python -c 'print()'
    pip freeze --exclude="{env:PY_MODULE}" --exclude=pipdeptree

    python -c 'print()'
    pipdeptree


##
# Release
##

[testenv:release]

description = invoke tool to manage a release branch

basepython = {[default]basepython}

skip_install = True

deps =
    -r requirements/release.txt
passenv =
    SSH_AUTH_SOCK

commands =
    python "{toxinidir}/release.py" {posargs}