Last active
August 29, 2015 14:22
-
-
Save AndreLouisCaron/c859efe3b061c7ce9895 to your computer and use it in GitHub Desktop.
Computing combined code coverage with Tox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[run] | |
source = | |
greet | |
[paths] | |
source = | |
. | |
.tox/py27/lib/python2.7/site-packages/ | |
.tox/py34/lib/python3.4/site-packages/ | |
.tox/pypy/site-packages/ | |
.tox/pypy3/site-packages/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This snippet shows how to configure Tox to compute combined code coverage after all other tets have run. | |
Notes: | |
- replace `greet` with the name of your Python package; | |
- the `coverage` environment *must* appear last in `envlist`; | |
- `coverage combine` will delete all temporary `.coverage.{envname}` files and replace them with a single `.coverage` file; | |
- you can run `coverage html` after `tox` to get an HTML report that highlights the source lines that were not covered by any environment. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[tox] | |
envlist = | |
coverage-erase, | |
py34, | |
py27, | |
pypy3, | |
pypy, | |
coverage-report, | |
[testenv] | |
deps = | |
nose | |
coverage | |
setenv = | |
COVERAGE_FILE=.coverage.{envname} | |
commands = | |
coverage run -m nose greet | |
[testenv:coverage-erase] | |
deps = | |
coverage | |
commands = | |
coverage erase | |
[testenv:coverage-report] | |
deps = | |
coverage | |
setenv = | |
COVERAGE_FILE=.coverage | |
commands = | |
coverage combine | |
coverage report --fail-under=100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment