forked from rstcheck/rstcheck-core
-
Notifications
You must be signed in to change notification settings - Fork 1
/
tox.ini
250 lines (223 loc) · 6.66 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
[tox]
package = rstcheck_core
minversion = 4
skip_missing_interpreters = true
ignore_base_python_conflict = true
no_package = false
env_list =
package
pre-commit-run
py{312,311,310,39,38}
py{312,311,310,39,38}-with-sphinx{4,5,6,7}
py{312,311,310,39,38}-with-tomli
coverage-all
docs-test-{html,linkcheck,coverage,doctest,spelling}
labels =
test = py{312,311,310,39,38},py{312,311,310,39,38}-with-sphinx{4,5,6,7},py{312,311,310,39,38}-with-tomli,coverage-all
py3.8 = py38,py38-with-sphinx{4,5,6,7},py38-with-tomli,coverage-all
py3.9 = py39,py39-with-sphinx{4,5,6,7},py39-with-tomli,coverage-all
py3.10 = py310,py310-with-sphinx{4,5,6,7},py310-with-tomli,package,coverage-all
py3.11 = py311,py311-with-sphinx{4,5,6,7},py311-with-tomli,package,coverage-all
py3.12 = py312,py312-with-sphinx{4,5,6,7},py312-with-tomli,package,coverage-all
docs = docs-test-{html,linkcheck,coverage,doctest,spelling}
[testenv]
description = basic config env
base_python = python3.11
pass_env =
HOME
CI
CI_FORCE_COLORS_PRE_COMMIT
CI_FORCE_COLORS_PYTEST
CI_FORCE_COLORS_SPHINX
set_env =
PIP_DISABLE_VERSION_CHECK = 1
download = true
commands =
echo "Please use available tox envs"
exit 1
[testenv:pre-commit]
description = format and check the code
env_dir = {toxworkdir}/pre-commit
pass_env =
{[testenv]pass_env}
SSH_AUTH_SOCK
SKIP
set_env =
{[testenv]set_env}
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
env_dir = {[testenv:pre-commit]env_dir}
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:mypy]
description = run mypy type checker
extras =
toml
type_check
docs
testing
ignore_errors = true
commands =
mypy src/rstcheck_core
mypy tests
mypy docs/source/conf.py
mypy prep_release.py
[testenv:pylint]
description = run pylint linter
deps =
pylint >= 2.12
extras =
toml
docs
testing
commands =
pylint src/rstcheck_core tests docs/source/conf.py prep_release.py
[testenv:package]
description = check sdist and wheel
skip_install = true
deps =
build >= 1
twine >= 3.3
commands =
python -m build
twine check --strict dist/*
[testenv:py{312,311,310,39,38}]
description = run tests with {basepython}
pass_env =
{[testenv]pass_env}
PYTEST_*
set_env =
{[testenv]set_env}
COVERAGE_FILE = {env:COVERAGE_FILE:{toxinidir}/.coverage_cache/.coverage.{envname}}
extras =
testing
yaml
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{312,311,310,39,38}-with-sphinx{4,5,6,7}]
description = run tests with {basepython} and sphinx
pass_env =
{[testenv]pass_env}
PYTEST_*
set_env =
{[testenv]set_env}
COVERAGE_FILE = {env:COVERAGE_FILE:{toxinidir}/.coverage_cache/.coverage.{envname}}
extras =
testing
yaml
deps =
sphinx4: sphinx>=4,<5
sphinx5: sphinx>=5,<6
sphinx6: sphinx>=6,<7
sphinx7: sphinx>=7,<8
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{312,311,310,39,38}-with-tomli]
description = run tests with {basepython} and toml
pass_env =
{[testenv]pass_env}
PYTEST_*
set_env =
{[testenv]set_env}
COVERAGE_FILE = {env:COVERAGE_FILE:{toxinidir}/.coverage_cache/.coverage.{envname}}
extras =
toml
testing
yaml
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)
env_dir = {toxworkdir}/coverage
depends = py{py3,312,311,310,39,38}
pass_env =
{[testenv]pass_env}
all,report: MIN_COVERAGE
all,report: MIN_DIFF_COVERAGE
all,report: DIFF_AGAINST
all,report: DIFF_RANGE_NOTATION
set_env =
{[testenv]set_env}
COVERAGE_FILE={toxinidir}/.coverage_cache/.coverage
skip_install = true
parallel_show_output = true
ignore_errors = true
deps =
diff-cover
coverage[toml] >=6.0
coverage-conditional-plugin >=0.5
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
env_dir = {toxworkdir}/docs
set_env =
{[testenv]set_env}
TOXENV_BUILDCMD = sphinx-build {tty:--color:}
auto: TOXENV_BUILDCMD = sphinx-autobuild --re-ignore autoapidoc --watch {toxinidir}/src
extras =
toml
docs
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
env_dir = {[testenv:docs]env_dir}
set_env =
{[testenv]set_env}
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}