tox.ini: use coverage.py instead of pytest-cov; run in --parallel-mode; use codecov instead of coveralls

We no longer use coverage.py through the pytest-cov plugin, as it does not
support --parallel-mode (or at least I wasn't able to figure it out).
We run pytest through `coverage run -m pytest` instead, which does the same
as `pytest --cov`.

Running `tox` locally by default will now run pytest and coverage on 2.7, 3.5 and 3.6; it will then
combine coverage data from all three, and finally generate a coverage report in htmlcov/index.html

We need tp temporarily install coverage.py from the mercurial repo instead of the latest release
because we require a patch that is not available yet with coverage 4.2:
https://bitbucket.org/ned/coveragepy/pull-requests/118/check-source-isdir-not-just-exists-there/diff

Finally, I replaced Coveralls with Codecov, as the latter is better designed and also supports Appveyor.
This commit is contained in:
Cosimo Lupo 2016-12-26 13:49:31 +00:00
parent c65a6548bd
commit 454f60f7b6
No known key found for this signature in database
GPG Key ID: B61AAAD0B53A6419

43
tox.ini
View File

@ -1,5 +1,5 @@
[tox] [tox]
envlist = py27, py35, py36 envlist = py{27,35,36}-cov, htmlcov
skip_missing_interpreters = true skip_missing_interpreters = true
[testenv] [testenv]
@ -10,33 +10,38 @@ basepython =
py35: {env:TOXPYTHON:python3.5} py35: {env:TOXPYTHON:python3.5}
py36: {env:TOXPYTHON:python3.6} py36: {env:TOXPYTHON:python3.6}
deps = deps =
# we install coverage from source until 4.3 is released, because of this:
# https://bitbucket.org/ned/coveragepy/pull-requests/118/check-source-isdir-not-just-exists-there/diff
cov: hg+https://bitbucket.org/ned/coveragepy#egg=coverage
pytest pytest
-rrequirements.txt -rrequirements.txt
install_command = install_command =
{envpython} -m pip install -v {opts} {packages} pip install -v {opts} {packages}
commands = commands =
# run the test suite against the package installed inside tox env # run the test suite against the package installed inside tox env.
py.test {posargs:--pyargs fontTools} # We use parallel mode and then combine later so that coverage.py will take
# paths like .tox/py36/lib/python3.6/site-packages/fontTools and collapse
# them into Lib/fontTools.
cov: coverage run --parallel-mode -m pytest {posargs:--pyargs fontTools}
nocov: pytest {posargs:--pyargs fontTools}
[testenv:coverage] [testenv:htmlcov]
basepython = {env:TOXPYTHON:python3.5} basepython = {env:TOXPYTHON:python3.5}
deps = deps =
{[testenv]deps} hg+https://bitbucket.org/ned/coveragepy#egg=coverage
pytest-cov
skip_install = true skip_install = true
commands= commands =
# measure test coverage and create html report coverage combine
py.test --cov --cov-report html {posargs} coverage html
[testenv:coveralls] [testenv:codecov]
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH passenv = *
basepython=python3.5 basepython = {env:TOXPYTHON:python}
deps = deps =
{[testenv:coverage]deps} hg+https://bitbucket.org/ned/coveragepy#egg=coverage
coveralls codecov
skip_install = true skip_install = true
ignore_outcome = true ignore_outcome = true
commands= commands =
# measure test coverage and upload report to coveralls coverage combine
py.test --cov codecov --env TOXENV
coveralls