-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtox.ini
More file actions
237 lines (218 loc) · 6.9 KB
/
tox.ini
File metadata and controls
237 lines (218 loc) · 6.9 KB
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
# Environments
# ============
#
# Labels
# ------
#
# In increasing level of integration:
# * lint: Lint all the things!
# * test: Run all tests on code, run pytest on stdlib examples.
# * meta: Integration tests - run as plugin and command against code and examples.
#
# Additional:
# * docs: Run documentation build.
# * requirements: Compile all requirements in required version of Python.
#
# Pip URL
# -------
#
# URL for pip is set as the default local URL for devpi server to avoid
# spamming PyPI. CI is run with the PIP_INDEX_URL env var set to point at the
# default PyPI simple index URL.
#
# Cheat-sheet
# -----------
#
# * When updating this file, check all default environments have a description:
# ``tox l``. Check a label's envs: ``tox l -m examples``.
# * `make docs` recipe can still be used to call tox to build HTML documentation.
[tox]
envlist =
py3{8,9,10,11,12,13,14}-lint_{code,examples}
py3{8,9,10,11,12,13,14}-test_{code,examples}
py3{8,9,10,11,12,13,14}-meta_plugin_{dogfood,default,option,config,black}
py310-docs
[testenv]
setenv =
PIP_INDEX_URL = {env:PIP_INDEX_URL:http://localhost:3141/root/pypi/+simple/}
package = wheel
wheel_build_env = .pkg
# === Env commands ===
# --- LINT: code ---
# Regular linting of code: flake8, yapf, mypy, etc.
[testenv:py3{8,9,10,11,12,13,14}-lint_code]
description = ⛏️ Regular linting of code: Flake8, yapf, mypy, etc.
labels =
lint
lint_code
deps =
-rrequirements/test.txt
commands =
make lint
allowlist_externals =
make
# --- LINT: examples ---
# Lint all good and bad examples. Includes linting with vanilla Flake8 and
# assert tests formatted with Black pass.
[testenv:py3{8,9,10,11,12,13,14}-lint_examples]
description = ⛏️ Lint examples, run stdlib examples on Pytest
labels =
lint
lint_examples
deps =
-rrequirements/examples.txt
skip_install = true
commands =
make lintexamples
allowlist_externals =
make
# --- TEST: code ---
# Run Pytest on all code
[testenv:py3{8,9,10,11,12,13,14}-test_code]
description = 🧰 Test all code
labels =
test
test_code
deps =
-rrequirements/test.txt
commands =
pytest {posargs:tests}
# --- TEST: Examples ---
# All stdlib examples executed with vanilla Pytest.
[testenv:py3{8,9,10,11,12,13,14}-test_examples]
description = 🧰 Test stdlib examples
labels =
test
test_examples
deps =
-rrequirements/examples.txt
skip_install = true
commands =
pytest \
examples/good/test_comments.py \
examples/good/test_with_statement.py \
examples/good/test_with_statement_unittest.py \
examples/good/test_assignment_operator.py \
examples/bad/file_pattern_test.py \
examples/bad/test_aaa02.py \
examples/bad/test_aaa03.py \
examples/bad/test_aaa03_04.py \
examples/bad/test_aaa04.py \
examples/bad/test_aaa05.py \
examples/bad/test_aaa06.py
# --- META: plugin ---
# Run as plugin to lint Flake8-AAA's own tests (dog fooding), and also lint all
# good and bad examples. Bad examples generate expected errors.
[base_meta_plugin]
labels =
meta
meta_plugin
deps =
flake8>=4
# Common full integration test command used to against good and bad examples,
# both with default and various configs
# TODO use --output-file for output
commands =
flake8 {env:FLAKE8FLAGS:} examples/good
bash -c "flake8 {env:FLAKE8FLAGS:} examples/bad/ | sort > {envtmpdir}/out"
bash -c "sort examples/bad/bad_expected.out > {envtmpdir}/expected_out"
diff {envtmpdir}/out {envtmpdir}/expected_out
allowlist_externals =
bash
diff
[testenv:py3{8,9,10,11,12,13,14}-meta_plugin_dogfood]
# No FLAKE8FLAGS set, so default behaviour
description = 🐕 Run -m flake_aaa against its own tests
labels =
{[base_meta_plugin]labels}
meta_plugin_dogfood
deps = {[base_meta_plugin]deps}
commands =
flake8 tests
[testenv:py3{8,9,10,11,12,13,14}-meta_plugin_default]
# No FLAKE8FLAGS set, so default behaviour
description = 🎈 Run -m flake_aaa against examples and tests
labels =
{[base_meta_plugin]labels}
meta_plugin_default
deps = {[base_meta_plugin]deps}
commands = {[base_meta_plugin]commands}
allowlist_externals = {[base_meta_plugin]allowlist_externals}
[testenv:py3{8,9,10,11,12,13,14}-meta_plugin_option]
# FLAKE8FLAGS set to command line options --aaa-* to their default values,
# ensure that defaults can be specified explicitly
description = 🎈 Run -m flake_aaa against examples and tests (pass default options)
labels =
{[base_meta_plugin]labels}
meta_plugin_option
setenv =
FLAKE8FLAGS = --aaa-act-block-style=default
deps = {[base_meta_plugin]deps}
commands = {[base_meta_plugin]commands}
allowlist_externals = {[base_meta_plugin]allowlist_externals}
[testenv:py3{8,9,10,11,12,13,14}-meta_plugin_config]
# FLAKE8FLAGS pass command line --config reference to config file with explicit
# defaults set to ensure defaults can be passed through explicitly
description = 🎈 Run -m flake_aaa against examples and tests (pass default config)
labels =
{[base_meta_plugin]labels}
meta_plugin_config
setenv =
FLAKE8FLAGS = --config=configs/explicit_default.ini
deps = {[base_meta_plugin]deps}
commands = {[base_meta_plugin]commands}
allowlist_externals = {[base_meta_plugin]allowlist_externals}
[testenv:py3{8,9,10,11,12,13,14}-meta_plugin_black]
# Run Black examples passing Act block style 'large' as command line option and
# passing as config.
description = 🎈 Run -m flake_aaa against Black formatted examples
labels =
{[base_meta_plugin]labels}
meta_plugin_black
deps = {[base_meta_plugin]deps}
commands =
flake8 --aaa-act-block-style=large examples/black
flake8 --config=configs/black_compatible.ini examples/black
# --- Docs ---
# Originally this env was used to check that RTD could build docs using py310,
# however, it's also used now to build docs on local when writing
# documentation.
[testenv:py310-docs]
description = 📕 Build docs
deps =
-rrequirements/docs.txt
commands =
make -C docs html
allowlist_externals =
make
# --- Requirements ---
# Do not emit index URL because running tox on devpi-server would normally
# cause that to be written as the index URL to the output text file, but we
# want to have the generated requirements files not linked to a particular index.
[testenv:py310-requirements]
description = 📦 Compile requirements
labels = requirements
deps =
pip-tools
commands =
pip-compile requirements/ci.in --no-emit-index-url
pip-compile requirements/docs.in --no-emit-index-url
[testenv:py38-requirements]
description = 📦 Compile requirements
labels = requirements
deps =
pip-tools
commands =
pip-compile requirements/dev.in --no-emit-index-url
pip-compile requirements/test.in --no-emit-index-url
pip-compile requirements/examples.in --no-emit-index-url
# --- Mappings for GitHub actions ---
[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311
3.12: py312
3.13: py313
3.14: py314