@@ -12,47 +12,61 @@ skip_missing_interpreters = true
12
12
13
13
[testenv]
14
14
description = run the tests with pytest under {basepython}
15
- setenv = COVERAGE_FILE ={toxworkdir}/.coverage.{envname}
15
+ setenv = PIP_DISABLE_VERSION_CHECK = 1
16
+ COVERAGE_FILE = {toxworkdir}/.coverage.{envname}
16
17
passenv = http_proxy https_proxy no_proxy SSL_CERT_FILE TOXENV CI TRAVIS TRAVIS_* APPVEYOR APPVEYOR_* CODECOV_*
18
+ deps =
17
19
extras = testing
18
- commands = pytest {posargs:--cov-config =" {toxinidir}/tox.ini" --cov =" {envsitepackagesdir}/tox" --timeout =180 tests}
20
+ changedir = {toxinidir}/tests
21
+ commands = pytest {posargs:--cov =" {envsitepackagesdir}/tox" --cov-config =" {toxinidir}/tox.ini" --timeout =180 .}
19
22
20
23
[testenv:docs]
21
24
description = invoke sphinx-build to build the HTML docs and check that all links are valid
22
25
whitelist_externals = sphinx-build
23
26
basepython = python3.6
24
27
extras = docs
28
+ changedir = {toxinidir}
25
29
commands = sphinx-build -d " {toxworkdir}/docs_doctree" doc " {toxworkdir}/docs_out" --color -W -bhtml
26
30
27
31
28
32
[testenv:fix-lint]
33
+ description = format the code base to adhere to our styles, and complain about what we cannot do automatically
29
34
basepython = python3.6
30
35
passenv = {[testenv]passenv}
31
36
HOMEPATH
32
37
# without PROGRAMDATA cloning using git for Windows will fail with an
33
38
# `error setting certificate verify locations` error
34
39
PROGRAMDATA
35
40
extras = lint
36
- description = run static analysis and style check using flake8
41
+ deps = pre-commit == 1.10.1
42
+ skip_install = True
43
+ changedir = {toxinidir}
37
44
commands = pre-commit run --all-files --show-diff-on-failure
38
45
python -c ' print("hint: run {envdir}/bin/pre-commit install to add checks as pre-commit hook")'
39
46
40
47
41
48
[testenv:coverage]
42
- description = combine coverage data and create reports
43
- deps = coverage
49
+ description = [run locally after tests]: combine coverage data and create report;
50
+ generates a diff coverage against origin/master (can be changed by setting DIFF_AGAINST env var)
51
+ deps = {[testenv]deps}
52
+ coverage >= 4.4.1, < 5
53
+ diff_cover
44
54
skip_install = True
45
- changedir = {toxworkdir}
46
- setenv = COVERAGE_FILE =.coverage
55
+ passenv = {[testenv]passenv}
56
+ DIFF_AGAINST
57
+ setenv = COVERAGE_FILE ={toxworkdir}/.coverage
58
+ changedir = {toxinidir}
47
59
commands = coverage erase
48
60
coverage combine
49
- coverage report --rcfile =" {toxinidir}/tox.ini"
50
- coverage xml
61
+ coverage report -m
62
+ coverage xml -o {toxworkdir}/coverage.xml
63
+ diff-cover --compare-branch {env:DIFF_AGAINST:origin/master} {toxworkdir}/coverage.xml
51
64
52
65
[testenv:codecov]
53
66
description = [only run on CI]: upload coverage data to codecov (depends on coverage running first)
54
67
deps = codecov
55
68
skip_install = True
69
+ changedir = {toxinidir}
56
70
commands = codecov --file " {toxworkdir}/coverage.xml"
57
71
58
72
[testenv:exit_code]
@@ -61,13 +75,15 @@ commands = codecov --file "{toxworkdir}/coverage.xml"
61
75
basepython = python3.6
62
76
description = commands with several exit codes
63
77
skip_install = True
78
+ changedir = {toxinidir}
64
79
commands = python3.6 -c " import sys; sys.exit(139)"
65
80
66
81
[testenv:pra]
67
82
platform = linux
68
83
passenv = *
69
84
description = " personal release assistant" - see HOWTORELEASE.rst
70
85
extras = publish, docs
86
+ changedir = {toxinidir}
71
87
commands = sphinx-build -d " {toxworkdir}/docs_doctree" doc " {toxworkdir}/docs_out" --color -W -blinkcheck
72
88
" {toxinidir}/tasks/pra.sh" {posargs}
73
89
@@ -81,6 +97,7 @@ extras = testing, docs
81
97
# required to make looponfail reload on every source code change
82
98
usedevelop = True
83
99
basepython = python3.6
100
+ changedir = {toxinidir}
84
101
commands = python -m pip list --format =columns
85
102
python -c ' import sys; print(sys.executable)'
86
103
@@ -90,21 +107,21 @@ max-line-length = 99
90
107
ignore = E203, W503
91
108
92
109
[coverage:run]
93
- omit = tox/__main__.py
110
+ branch = true
94
111
95
112
[coverage:report]
96
113
skip_covered = True
97
114
show_missing = True
98
115
exclude_lines = if __name__ == [" ']__main__[" ' ]:
99
116
100
117
[coverage:paths]
101
- source = tox
102
- {toxworkdir} /*/lib/python*/site-packages/tox
103
- {toxworkdir} /*/Lib/site-packages/tox
104
- {toxworkdir} /pypy*/site-packages/tox
118
+ source = src/ tox
119
+ .tox /*/lib/python*/site-packages/tox
120
+ .tox /*/Lib/site-packages/tox
121
+ .tox /pypy*/site-packages/tox
105
122
106
123
[pytest]
107
- addopts = -rsxX -vvv - -showlocals
124
+ addopts = -rsxX --showlocals
108
125
rsyncdirs = tests tox
109
126
looponfailroots = tox tests
110
127
norecursedirs = .hg .tox
0 commit comments