Spiff up the tox config a bit more

This commit is contained in:
Wilfredo Sánchez 2020-04-01 19:34:40 -07:00
parent cd9e666ca3
commit a08690cae1
2 changed files with 64 additions and 47 deletions

View File

@ -22,7 +22,7 @@ matrix:
- python: "3.8"
env: TOXENV=test-py38,codecov
- python: "pypy"
env: TOXENV=test-pypy,codecov
env: TOXENV=test-pypy2,codecov
- python: "pypy3"
env: TOXENV=test-pypy3,codecov
- python: "2.7"

109
tox.ini
View File

@ -10,8 +10,27 @@ envlist =
skip_missing_interpreters = {tty:True:False}
[default]
basepython = python3.8
deps =
idna==2.9
test: typing==3.7.4.1
test: {[testenv:coverage_report]deps}
test-{py26,py27,py34}: pytest==4.6.9
test-{py35,py36,py37,py38}: pytest==5.2.4
test: pytest-cov==2.8.1
setenv =
PY_MODULE=hyperlink
PYTHONPYCACHEPREFIX={envtmpdir}/pycache
##
# Build (default environment)
# Default environment: unit tests
##
[testenv]
@ -27,39 +46,16 @@ basepython =
py37: python3.7
py38: python3.8
py39: python3.9
pypy: pypy
pypy2: pypy
pypy3: pypy3
deps =
test: coverage==4.5.4 # rq.filter: <5
test: idna==2.9
test: typing==3.7.4.1
test: {py26,py27,py34}: pytest==4.6.9
test: {py35,py36,py37,py38}: pytest==5.2.4
test: pytest-cov==2.8.1
passenv =
# See https://github.com/codecov/codecov-python/blob/master/README.md#using-tox
# And CI-specific docs:
# https://help.github.com/en/articles/virtual-environments-for-github-actions#default-environment-variables
# https://docs.travis-ci.com/user/environment-variables#default-environment-variables
# https://www.appveyor.com/docs/environment-variables/
codecov: TOXENV CODECOV_* CI
codecov: GITHUB_*
codecov: TRAVIS TRAVIS_*
codecov: APPVEYOR APPVEYOR_*
# Used in our AppVeyor config
codecov: OS
deps = {[default]deps}
setenv =
PY_MODULE=hyperlink
test: PYTHONPYCACHEPREFIX={envtmpdir}/pycache
{[default]setenv}
test: COVERAGE_FILE={toxworkdir}/coverage.{envname}
{coverage_report,codecov}: COVERAGE_FILE={toxworkdir}/coverage
codecov: COVERAGE_XML={envlogdir}/coverage_report.xml
commands =
test: pytest --cov={env:PY_MODULE} --cov-report=term-missing:skip-covered --doctest-modules {posargs:src/{env:PY_MODULE}}
@ -73,16 +69,16 @@ commands =
description = run Flake8 (linter)
basepython = python3.8
basepython = {[default]basepython}
skip_install = True
deps =
flake8-bugbear==20.1.4
#flake8-docstrings==1.5.0
flake8==3.7.9
mccabe==0.6.1
pep8-naming==0.10.0
pycodestyle==2.5.0
pydocstyle==5.0.2
# pin pyflakes pending a release with https://github.com/PyCQA/pyflakes/pull/455
git+git://github.com/PyCQA/pyflakes@ffe9386#egg=pyflakes
@ -137,13 +133,13 @@ application-import-names = deploy
description = run Mypy (static type checker)
basepython = python3.8
skip_install = True
basepython = {[default]basepython}
deps =
mypy==0.770
{[default]deps}
commands =
mypy \
--config-file="{toxinidir}/tox.ini" \
@ -170,11 +166,7 @@ warn_return_any = True
warn_unreachable = True
warn_unused_ignores = True
[mypy-hyperlink._url]
# Don't complain about dependencies known to lack type hints
# 4 at time of writing (2020-20-01), so maybe disable this soon
allow_untyped_defs = True
[mypy-idna]
ignore_missing_imports = True
@ -188,12 +180,19 @@ ignore_missing_imports = True
description = generate coverage report
depends = test-py{26,27,34,35,36,37,38,py,py3}
basepython = python
skip_install = True
deps =
coverage==4.5.4
coverage==4.5.4 # rq.filter: <5
setenv =
{[default]setenv}
COVERAGE_FILE={toxworkdir}/coverage
commands =
coverage combine
@ -209,17 +208,34 @@ commands =
description = upload coverage to Codecov
depends = {[coverage_report]depends}
basepython = python
skip_install = True
deps =
coverage==4.5.4
{[testenv:coverage_report]deps}
codecov==2.0.22
commands =
# Note documentation for CI variables in default environment's passenv
passenv =
# See https://github.com/codecov/codecov-python/blob/master/README.md#using-tox
# And CI-specific docs:
# https://help.github.com/en/articles/virtual-environments-for-github-actions#default-environment-variables
# https://docs.travis-ci.com/user/environment-variables#default-environment-variables
# https://www.appveyor.com/docs/environment-variables/
TOXENV CODECOV_* CI
GITHUB_*
TRAVIS TRAVIS_*
APPVEYOR APPVEYOR_*
setenv =
{[testenv:coverage_report]setenv}
COVERAGE_XML={envlogdir}/coverage_report.xml
commands =
# Note documentation for CI variables in passenv above
coverage combine
coverage xml -o "{env:COVERAGE_XML}"
codecov --file="{env:COVERAGE_XML}" --env \
@ -239,7 +255,7 @@ commands =
description = build documentation
basepython = python3.8
basepython = {[default]basepython}
deps =
Sphinx==2.3.1
@ -256,11 +272,10 @@ commands =
description = build documentation and rebuild automatically
basepython = python3.8
basepython = {[default]basepython}
deps =
Sphinx==2.2.2
sphinx-rtd-theme==0.4.3
{[testenv:docs]deps}
sphinx-autobuild==0.7.1
commands =
@ -279,7 +294,9 @@ commands =
description = check for potential packaging problems
basepython = python
basepython = {[default]basepython}
skip_install = True
deps =
check-manifest==0.41