forked from rstcheck/rstcheck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
260 lines (230 loc) · 7.06 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
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
[tox]
package = rstcheck
minversion = 3.15.0
requires =
tox-envlist
skip_missing_interpreters = true
ignore_basepython_conflict = true
isolated_build = true
skipsdist = false
envlist =
package
pre-commit-run
py{311,310,39,38,37}
py{311,310,39,38,37}-with-sphinx{2,3,4,5}
py{311,310,39,38,37}-with-tomli
coverage-all
docs-test-{html,linkcheck,coverage,doctest,spelling}
[envlists]
test = py{311,310,39,38,37},py{311,310,39,38,37}-with-sphinx{2,3,4,5},py{311,310,39,38,37}-with-tomli,coverage-all
py3.7 = py37,py37-with-sphinx{2,3,4,5},py37-with-tomli,coverage-all
py3.8 = py38,py38-with-sphinx{2,3,4,5},py38-with-tomli,coverage-all
py3.9 = py39,py39-with-sphinx{2,3,4,5},py39-with-tomli,coverage-all
py3.10 = py310,py310-with-sphinx{2,3,4,5},py310-with-tomli,package,coverage-all
py3.11 = py311,py311-with-sphinx{2,3,4,5},py311-with-tomli,package,coverage-all
docs = docs-test-{html,linkcheck,coverage,doctest,spelling}
[testenv]
description = basic config env
passenv =
HOME
CI
CI_FORCE_COLORS_PRE_COMMIT
CI_FORCE_COLORS_POETRY
CI_FORCE_COLORS_PYTEST
CI_FORCE_COLORS_SPHINX
setenv =
PIP_DISABLE_VERSION_CHECK = 1
download = true
[testenv:pre-commit]
description = format and check the code
envdir = {toxworkdir}/pre-commit
passenv =
{[testenv]passenv}
SSH_AUTH_SOCK
SKIP
setenv =
{[testenv]setenv}
SKIP = {tty:identity:},{env:SKIP:}
skip_install = true
deps = pre-commit >= 2.17
commands =
pre-commit {posargs:--help}
[testenv:pre-commit-run]
description = install pre-commit as git hook from the tox env
envdir = {[testenv:pre-commit]envdir}
skip_install = {[testenv:pre-commit]skip_install}
deps = {[testenv:pre-commit]deps}
commands =
pre-commit run {posargs} \
--all-files \
{tty::--show-diff-on-failure} \
{tty:--color always:{env:CI_FORCE_COLORS_PRE_COMMIT:}}
[testenv:pre-commit-install]
description = install pre-commit as git hook from the tox env
envdir = {[testenv:pre-commit]envdir}
skip_install = {[testenv:pre-commit]skip_install}
deps = {[testenv:pre-commit]deps}
commands = pre-commit install
[testenv:mypy]
description = run mypy type checker
deps = mypy >=0.931
extras =
sphinx
toml
testing
docs
ignore_errors = true
commands =
mypy src/rstcheck
mypy tests
mypy docs/source/conf.py
mypy prep_release.py
[testenv:pylint]
description = run pylint linter
deps = pylint >= 2.12
extras =
sphinx
toml
testing
docs
commands = pylint src/rstcheck tests docs/source/conf.py prep_release.py
[testenv:package]
description = check sdist and wheel
skip_install = true
deps =
poetry >= 1.1.13
twine >= 3.3
commands =
poetry build {tty:--ansi:{env:CI_FORCE_COLORS_POETRY:}} --no-interaction -vv
twine check --strict dist/*
[testenv:py{311,310,39,38,37}]
description = run tests with {basepython}
passenv =
{[testenv]passenv}
PYTEST_*
setenv =
{[testenv]setenv}
COVERAGE_FILE = {env:COVERAGE_FILE:{toxinidir}/.coverage_cache/.coverage.{envname}}
extras = testing
commands =
pytest \
{tty:--color yes:{env:CI_FORCE_COLORS_PYTEST:}} \
--basetemp {envtmpdir} \
--cov {envsitepackagesdir}/{[tox]package} \
--cov-fail-under 0 \
{tty::-vvv} \
{posargs:tests}
[testenv:py{311,310,39,38,37}-with-sphinx{2,3,4,5}]
description = run tests with {basepython} and sphinx
passenv =
{[testenv]passenv}
PYTEST_*
setenv =
{[testenv]setenv}
COVERAGE_FILE = {env:COVERAGE_FILE:{toxinidir}/.coverage_cache/.coverage.{envname}}
extras = testing
deps =
sphinx2,sphinx3: jinja2<3
sphinx2,sphinx3: markupsafe<2
sphinx2: sphinx>=2,<3
sphinx3: sphinx>=3,<4
# With python 3.10 there is a failing import added in sphinx 3.5
py310-sphinx3: sphinx>=3,<3.5
py311-sphinx3: sphinx>=3,<3.5
sphinx4: sphinx>=4,<5
sphinx5: sphinx>=5,<6
commands =
pytest \
{tty:--color yes:{env:CI_FORCE_COLORS_PYTEST:}} \
--basetemp {envtmpdir} \
--cov {envsitepackagesdir}/{[tox]package} \
--cov-fail-under 0 \
{tty::-vvv} \
{posargs:tests}
[testenv:py{311,310,39,38,37}-with-tomli]
description = run tests with {basepython} and tomli
passenv =
{[testenv]passenv}
PYTEST_*
setenv =
{[testenv]setenv}
COVERAGE_FILE = {env:COVERAGE_FILE:{toxinidir}/.coverage_cache/.coverage.{envname}}
extras =
testing
tomli
commands =
pytest \
{tty:--color yes:{env:CI_FORCE_COLORS_PYTEST:}} \
--basetemp {envtmpdir} \
--cov {envsitepackagesdir}/{[tox]package} \
--cov-fail-under 0 \
{tty::-vvv} \
{posargs:tests}
[testenv:coverage-{all,merge,report}]
description =
all,merge: combine coverage data and create xml/html reports;
all,report: report total and diff coverage against origin/main (or DIFF_AGAINST)
envdir = {toxworkdir}/coverage
depends = py{py3,311,310,39,38}
passenv =
{[testenv]passenv}
all,report: MIN_COVERAGE
all,report: MIN_DIFF_COVERAGE
all,report: DIFF_AGAINST
all,report: DIFF_RANGE_NOTATION
setenv =
{[testenv]setenv}
COVERAGE_FILE={toxinidir}/.coverage_cache/.coverage
skip_install = true
parallel_show_output = true
ignore_errors = true
deps =
coverage[toml] >= 6
coverage-conditional-plugin >= 0.5
diff-cover
commands =
all,merge: coverage combine
all,merge: coverage xml -o {toxinidir}/.coverage_cache/coverage.xml
all,merge: coverage html -d {toxinidir}/.coverage_cache/htmlcov
all,report: coverage report -m --fail-under {env:MIN_COVERAGE:0}
all,report: diff-cover --compare-branch {env:DIFF_AGAINST:origin/main} \
all,report: --ignore-staged --ignore-unstaged \
all,report: --fail-under {env:MIN_DIFF_COVERAGE:0} \
all,report: --diff-range-notation {env:DIFF_RANGE_NOTATION:..} \
all,report: {toxinidir}/.coverage_cache/coverage.xml
[testenv:docs{,-auto}]
description = build docs with sphinx
envdir = {toxworkdir}/docs
setenv =
{[testenv]setenv}
TOXENV_BUILDCMD = sphinx-build {tty:--color:}
auto: TOXENV_BUILDCMD = sphinx-autobuild --re-ignore autoapidoc --watch {toxinidir}/src
extras =
docs
sphinx
toml
commands =
# Build fresh docs
{env:TOXENV_BUILDCMD} -b html -aE docs/source docs/build/html
# Output link to index.html
python -c \
'from pathlib import Path; \
index_file = Path(r"{toxinidir}")/"docs/build/html/index.html"; \
print(f"DOCUMENTATION AVAILABLE UNDER: \{index_file.as_uri()\}")'
[testenv:docs-test-{html,linkcheck,coverage,doctest,spelling}]
description = Build and check docs with (see env name) sphinx builder
envdir = {[testenv:docs]envdir}
setenv =
{[testenv]setenv}
html: TOXENV_BUILDER = html
linkcheck: TOXENV_BUILDER = linkcheck
coverage: TOXENV_BUILDER = coverage
doctest: TOXENV_BUILDER = doctest
spelling: TOXENV_BUILDER = spelling
extras = {[testenv:docs]extras}
commands =
sphinx-build \
{tty:--color:{env:CI_FORCE_COLORS_SPHINX:}} \
-b {env:TOXENV_BUILDER} \
-aE -v -nW --keep-going \
docs/source docs/build/test/{env:TOXENV_BUILDER}