forked from jamescooke/flake8-aaa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtox.ini
252 lines (232 loc) · 6.94 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
# 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.
#
# 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{7,8,9,10,11}-lint_{code,examples}
py3{7,8,9,10,11}-test_{code,examples}
py3{7,8,9,10,11}-meta_plugin_{dogfood,default,option,config,black}
py3{7,8,9,10,11}-meta_command
py310-docs
[testenv]
setenv =
PIP_INDEX_URL = {env:PIP_INDEX_URL:http://localhost:3141/root/pypi/+simple/}
# === Env commands ===
# --- LINT: code ---
# Regular linting of code: flake8, yapf, mypy, etc.
[testenv:py3{7,8,9,10,11}-lint_code]
description = ⛏️ Regular linting of code: Flake8, yapf, mypy, etc.
labels =
lint
lint_code
deps =
-rrequirements/test.txt
skip_install = true
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:py37-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
# Extra checks on Python 3.8 (and later) files
# Future work: Merge with above in #198
[testenv:py3{8,9,10,11}-lint_examples]
description = {[testenv:py37-lint_examples]description}
labels =
lint
lint_examples
deps = {[testenv:py37-lint_examples]deps}
skip_install = true
commands =
{[testenv:py37-lint_examples]commands}
make lintexamplespy38
allowlist_externals =
make
# --- TEST: code ---
# Run Pytest on all code
[testenv:py3{7,8,9,10,11}-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:py37-test_examples]
description = 🧰 Test stdlib examples on py37
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/bad/file_pattern_test.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
# Extra checks on Python 3.8 (and later) files
# Future work: Merge with above in #198
[testenv:py3{8,9,10,11}-test_examples]
description = 🧰 Test stdlib examples on py38+
labels =
test
test_examples
deps =
-rrequirements/examples.txt
skip_install = true
commands =
{[testenv:py37-test_examples]commands}
pytest examples/good_py38/test_assignment_operator.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{7,8,9,10,11}-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{7,8,9,10,11}-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{7,8,9,10,11}-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{7,8,9,10,11}-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{7,8,9,10,11}-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
# --- META: command ---
# Run `... -m flake8_aaa`) on all example files. Check errors from bad examples
# are as expected.
[testenv:py3{7,8,9,10,11}-meta_command]
description = 🖥️ Run command "-m flake8_aaa" on all examples
labels =
meta
meta_cmd
commands =
make cmd
make cmdbad
allowlist_externals =
make
# --- 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
# --- Mappings for GitHub actions ---
[gh-actions]
python =
3.7: py37
3.8: py38
3.9: py39
3.10: py310
3.11: py311