1
1
[tox]
2
2
3
3
envlist =
4
- flake8, mypy
4
+ flake8, mypy # black
5
5
test-py{26,27,34,35,36,37,38,py,py3}
6
6
coverage_report
7
- packaging
8
7
docs
8
+ packaging
9
9
10
10
skip_missing_interpreters = {tty:True:False}
11
11
12
12
13
+ [default]
14
+
15
+ basepython = python3.8
16
+
17
+ setenv =
18
+ PY_MODULE =hyperlink
19
+
20
+ PYTHONPYCACHEPREFIX ={envtmpdir}/pycache
21
+
22
+
13
23
# #
14
- # Build (default environment)
24
+ # Default environment: unit tests
15
25
# #
16
26
17
27
[testenv]
@@ -31,40 +41,56 @@ basepython =
31
41
pypy3: pypy3
32
42
33
43
deps =
34
- test: coverage ==4.5.4
35
44
test: idna ==2.8
36
45
test: typing ==3.7.4.1
37
46
test: {py26,py27,py34}: pytest ==4.6.7
38
47
test: {py35,py36,py37,py38}: pytest ==5.2.4
39
48
test: pytest-cov ==2.8.1
49
+ test: {[testenv:coverage_report]deps}
40
50
41
51
passenv =
42
- # See https://github.com/codecov/codecov-python/blob/master/README.md#using-tox
43
- # And CI-specific docs:
44
- # https://help.github.com/en/articles/virtual-environments-for-github-actions#default-environment-variables
45
- # https://docs.travis-ci.com/user/environment-variables#default-environment-variables
46
- # https://www.appveyor.com/docs/environment-variables/
47
- codecov: TOXENV CODECOV_* CI
48
- codecov: GITHUB_*
49
- codecov: TRAVIS TRAVIS_*
50
- codecov: APPVEYOR APPVEYOR_*
51
-
52
- # Used in our AppVeyor config
53
- codecov: OS
52
+ test: CI
54
53
55
54
setenv =
56
- PY_MODULE =hyperlink
57
-
58
- test: PYTHONPYCACHEPREFIX ={envtmpdir}/pycache
55
+ {[default]setenv}
59
56
60
57
test: COVERAGE_FILE ={toxworkdir}/coverage.{envname}
61
- {coverage_report,codecov}: COVERAGE_FILE ={toxworkdir}/coverage
62
- codecov: COVERAGE_XML ={envlogdir}/coverage_report.xml
63
58
64
59
commands =
65
60
test: pytest --cov ={env:PY_MODULE} --cov-report =term-missing:skip-covered --doctest-modules {posargs:src/{env:PY_MODULE}}
66
61
67
62
63
+ # #
64
+ # Black code formatting
65
+ # #
66
+
67
+ [testenv:black]
68
+
69
+ description = run Black (linter)
70
+
71
+ basepython = {[default]basepython}
72
+
73
+ skip_install = True
74
+
75
+ deps =
76
+ black ==19.10b0
77
+
78
+ setenv =
79
+ BLACK_LINT_ARGS =--check
80
+
81
+ commands =
82
+ black {env:BLACK_LINT_ARGS:} src
83
+
84
+
85
+ [testenv:black-reformat]
86
+
87
+ description = {[testenv:black]description} and reformat
88
+ basepython = {[testenv:black]basepython}
89
+ skip_install = {[testenv:black]skip_install}
90
+ deps = {[testenv:black]deps}
91
+ commands = {[testenv:black]commands}
92
+
93
+
68
94
# #
69
95
# Flake8 linting
70
96
# #
@@ -73,16 +99,16 @@ commands =
73
99
74
100
description = run Flake8 (linter)
75
101
76
- basepython = python3.8
102
+ basepython = {[default]basepython}
77
103
78
104
skip_install = True
79
105
80
106
deps =
81
107
flake8-bugbear ==19.8.0
82
- # flake8-docstrings==1.5.0
83
108
flake8 ==3.7.9
84
109
mccabe ==0.6.1
85
110
pep8-naming ==0.9.1
111
+ pycodestyle ==2.5.0
86
112
pydocstyle ==5.0.1
87
113
# pin pyflakes pending a release with https://github.com/PyCQA/pyflakes/pull/455
88
114
git+git://github.com/PyCQA/pyflakes@ffe9386# egg=pyflakes
@@ -99,6 +125,8 @@ select = A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z
99
125
show-source = True
100
126
doctests = True
101
127
128
+ max-line-length = 80
129
+
102
130
# Codes: http://flake8.pycqa.org/en/latest/user/error-codes.html
103
131
ignore =
104
132
# syntax error in type comment
@@ -119,8 +147,8 @@ ignore =
119
147
# variable in global scope should not be mixedCase
120
148
N816,
121
149
122
- # line break after binary operator
123
- W504 ,
150
+ # line break before binary operator
151
+ W503 ,
124
152
125
153
# End of list (allows last item to end with trailing ',')
126
154
EOL
@@ -137,12 +165,10 @@ application-import-names = deploy
137
165
138
166
description = run Mypy (static type checker)
139
167
140
- basepython = python3.8
141
-
142
- skip_install = True
168
+ basepython = {[default]basepython}
143
169
144
170
deps =
145
- mypy ==0.750
171
+ mypy ==0.760
146
172
147
173
commands =
148
174
mypy \
@@ -188,12 +214,19 @@ ignore_missing_imports = True
188
214
189
215
description = generate coverage report
190
216
191
- basepython = python
217
+ depends = test-py{36,37,38,39,py3}
218
+
219
+ basepython = {[default]basepython}
192
220
193
221
skip_install = True
194
222
195
223
deps =
196
- coverage ==4.5.4
224
+ coverage ==5.0.3
225
+
226
+ setenv =
227
+ {[default]setenv}
228
+
229
+ COVERAGE_FILE ={toxworkdir}/coverage
197
230
198
231
commands =
199
232
coverage combine
@@ -209,17 +242,35 @@ commands =
209
242
210
243
description = upload coverage to Codecov
211
244
245
+ depends = {[coverage_report]depends}
246
+
212
247
basepython = python
213
248
214
249
skip_install = True
215
250
216
251
deps =
217
- coverage ==4.5.4
252
+ {[testenv:coverage_report]deps}
253
+
218
254
codecov ==2.0.15
219
255
220
- commands =
221
- # Note documentation for CI variables in default environment's passenv
256
+ passenv =
257
+ # See https://github.com/codecov/codecov-python/blob/master/README.md#using-tox
258
+ # And CI-specific docs:
259
+ # https://help.github.com/en/articles/virtual-environments-for-github-actions#default-environment-variables
260
+ # https://docs.travis-ci.com/user/environment-variables#default-environment-variables
261
+ # https://www.appveyor.com/docs/environment-variables/
262
+ TOXENV CODECOV_* CI
263
+ GITHUB_*
264
+ TRAVIS TRAVIS_*
265
+ APPVEYOR APPVEYOR_*
266
+
267
+ setenv =
268
+ {[testenv:coverage_report]setenv}
269
+
270
+ COVERAGE_XML ={envlogdir}/coverage_report.xml
222
271
272
+ commands =
273
+ # Note documentation for CI variables in passenv above
223
274
coverage combine
224
275
coverage xml -o " {env:COVERAGE_XML}"
225
276
codecov --file =" {env:COVERAGE_XML}" --env \
@@ -239,36 +290,36 @@ commands =
239
290
240
291
description = build documentation
241
292
242
- basepython = python3.8
293
+ basepython = {[default]basepython}
243
294
244
295
deps =
245
- Sphinx ==2.2.2
296
+ Sphinx ==2.3.0
246
297
sphinx-rtd-theme ==0.4.3
247
298
248
299
commands =
249
300
sphinx-build \
250
301
-b html -d " {envtmpdir}/doctrees" \
251
302
" {toxinidir}/docs" \
252
- " {toxworkdir}/docs/html "
303
+ " {toxinidir}/htmldocs "
253
304
254
305
255
306
[testenv:docs-auto]
256
307
257
308
description = build documentation and rebuild automatically
258
309
259
- basepython = python3.8
310
+ basepython = {[default]basepython}
260
311
261
312
deps =
262
- Sphinx ==2.2.2
263
- sphinx-rtd-theme ==0.4.3
313
+ {[testenv:docs]deps}
314
+
264
315
sphinx-autobuild ==0.7.1
265
316
266
317
commands =
267
318
sphinx-autobuild \
268
319
-b html -d " {envtmpdir}/doctrees" \
269
320
--host =localhost \
270
321
" {toxinidir}/docs" \
271
- " {toxworkdir}/docs/html "
322
+ " {toxinidir}/htmldocs "
272
323
273
324
274
325
# #
@@ -279,12 +330,14 @@ commands =
279
330
280
331
description = check for potential packaging problems
281
332
282
- basepython = python
333
+ basepython = {[default]basepython}
334
+
335
+ skip_install = True
283
336
284
337
deps =
285
338
check-manifest ==0.40
286
339
readme_renderer ==24.0
287
- twine ==2.0.0
340
+ twine ==3.1.1
288
341
289
342
commands =
290
343
check-manifest
0 commit comments