11[tox]
22
33envlist =
4- flake8, mypy
4+ flake8, mypy # black
55 test-py{26,27,34,35,36,37,38,py,py3}
66 coverage_report
7- packaging
87 docs
8+ packaging
99
1010skip_missing_interpreters = {tty:True:False}
1111
1212
13+ [default]
14+
15+ basepython = python3.8
16+
17+ setenv =
18+ PY_MODULE =hyperlink
19+
20+ PYTHONPYCACHEPREFIX ={envtmpdir}/pycache
21+
22+
1323# #
14- # Build (default environment)
24+ # Default environment: unit tests
1525# #
1626
1727[testenv]
@@ -31,40 +41,56 @@ basepython =
3141 pypy3: pypy3
3242
3343deps =
34- test: coverage ==4.5.4
3544 test: idna ==2.8
3645 test: typing ==3.7.4.1
3746 test: {py26,py27,py34}: pytest ==4.6.7
3847 test: {py35,py36,py37,py38}: pytest ==5.2.4
3948 test: pytest-cov ==2.8.1
49+ test: {[testenv:coverage_report]deps}
4050
4151passenv =
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
5453
5554setenv =
56- PY_MODULE =hyperlink
57-
58- test: PYTHONPYCACHEPREFIX ={envtmpdir}/pycache
55+ {[default]setenv}
5956
6057 test: COVERAGE_FILE ={toxworkdir}/coverage.{envname}
61- {coverage_report,codecov}: COVERAGE_FILE ={toxworkdir}/coverage
62- codecov: COVERAGE_XML ={envlogdir}/coverage_report.xml
6358
6459commands =
6560 test: pytest --cov ={env:PY_MODULE} --cov-report =term-missing:skip-covered --doctest-modules {posargs:src/{env:PY_MODULE}}
6661
6762
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+
6894# #
6995# Flake8 linting
7096# #
@@ -73,16 +99,16 @@ commands =
7399
74100description = run Flake8 (linter)
75101
76- basepython = python3.8
102+ basepython = {[default]basepython}
77103
78104skip_install = True
79105
80106deps =
81107 flake8-bugbear ==19.8.0
82- # flake8-docstrings==1.5.0
83108 flake8 ==3.7.9
84109 mccabe ==0.6.1
85110 pep8-naming ==0.9.1
111+ pycodestyle ==2.5.0
86112 pydocstyle ==5.0.1
87113 # pin pyflakes pending a release with https://github.com/PyCQA/pyflakes/pull/455
88114 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
99125show-source = True
100126doctests = True
101127
128+ max-line-length = 80
129+
102130# Codes: http://flake8.pycqa.org/en/latest/user/error-codes.html
103131ignore =
104132 # syntax error in type comment
@@ -119,8 +147,8 @@ ignore =
119147 # variable in global scope should not be mixedCase
120148 N816,
121149
122- # line break after binary operator
123- W504 ,
150+ # line break before binary operator
151+ W503 ,
124152
125153 # End of list (allows last item to end with trailing ',')
126154 EOL
@@ -137,12 +165,10 @@ application-import-names = deploy
137165
138166description = run Mypy (static type checker)
139167
140- basepython = python3.8
141-
142- skip_install = True
168+ basepython = {[default]basepython}
143169
144170deps =
145- mypy ==0.750
171+ mypy ==0.760
146172
147173commands =
148174 mypy \
@@ -188,12 +214,19 @@ ignore_missing_imports = True
188214
189215description = generate coverage report
190216
191- basepython = python
217+ depends = test-py{36,37,38,39,py3}
218+
219+ basepython = {[default]basepython}
192220
193221skip_install = True
194222
195223deps =
196- coverage ==4.5.4
224+ coverage ==5.0.3
225+
226+ setenv =
227+ {[default]setenv}
228+
229+ COVERAGE_FILE ={toxworkdir}/coverage
197230
198231commands =
199232 coverage combine
@@ -209,17 +242,35 @@ commands =
209242
210243description = upload coverage to Codecov
211244
245+ depends = {[coverage_report]depends}
246+
212247basepython = python
213248
214249skip_install = True
215250
216251deps =
217- coverage ==4.5.4
252+ {[testenv:coverage_report]deps}
253+
218254 codecov ==2.0.15
219255
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
222271
272+ commands =
273+ # Note documentation for CI variables in passenv above
223274 coverage combine
224275 coverage xml -o " {env:COVERAGE_XML}"
225276 codecov --file =" {env:COVERAGE_XML}" --env \
@@ -239,36 +290,36 @@ commands =
239290
240291description = build documentation
241292
242- basepython = python3.8
293+ basepython = {[default]basepython}
243294
244295deps =
245- Sphinx ==2.2.2
296+ Sphinx ==2.3.0
246297 sphinx-rtd-theme ==0.4.3
247298
248299commands =
249300 sphinx-build \
250301 -b html -d " {envtmpdir}/doctrees" \
251302 " {toxinidir}/docs" \
252- " {toxworkdir}/docs/html "
303+ " {toxinidir}/htmldocs "
253304
254305
255306[testenv:docs-auto]
256307
257308description = build documentation and rebuild automatically
258309
259- basepython = python3.8
310+ basepython = {[default]basepython}
260311
261312deps =
262- Sphinx ==2.2.2
263- sphinx-rtd-theme ==0.4.3
313+ {[testenv:docs]deps}
314+
264315 sphinx-autobuild ==0.7.1
265316
266317commands =
267318 sphinx-autobuild \
268319 -b html -d " {envtmpdir}/doctrees" \
269320 --host =localhost \
270321 " {toxinidir}/docs" \
271- " {toxworkdir}/docs/html "
322+ " {toxinidir}/htmldocs "
272323
273324
274325# #
@@ -279,12 +330,14 @@ commands =
279330
280331description = check for potential packaging problems
281332
282- basepython = python
333+ basepython = {[default]basepython}
334+
335+ skip_install = True
283336
284337deps =
285338 check-manifest ==0.40
286339 readme_renderer ==24.0
287- twine ==2.0.0
340+ twine ==3.1.1
288341
289342commands =
290343 check-manifest
0 commit comments