Avoid running coverage when it's unneeded.

Unfortunately running coverage means our tests need more than a minute longer
to run.

We still run it in the following scenarios:
    - Full 'tox' run
    - On Travis CI on Linux
    - On the buildbot on Archlinux

But not anymore in the following scenarios:
    - When running 'tox -e py35' (or py34)
    - On Travis CI on OS X
    - On AppVeyor
    - On the buildbot except on Archlinux
This commit is contained in:
Florian Bruhin 2016-01-24 20:01:14 +01:00
parent 44a096012b
commit 95fe54f010
3 changed files with 26 additions and 7 deletions

View File

@ -12,7 +12,7 @@ env:
- PATH=/home/travis/bin:/home/travis/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin - PATH=/home/travis/bin:/home/travis/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
matrix: matrix:
- TESTENV=py35 - TESTENV=py35
- TESTENV=py34 - TESTENV=py34-cov
- TESTENV=unittests-nodisp - TESTENV=unittests-nodisp
- TESTENV=misc - TESTENV=misc
- TESTENV=vulture - TESTENV=vulture
@ -38,14 +38,14 @@ script:
- tox -e $TESTENV -- -v --cov-report term tests - tox -e $TESTENV -- -v --cov-report term tests
after_success: after_success:
- '[[ ($TESTENV == py34 || $TESTENV == py35) && $TRAVIS_OX == linux ]] && codecov -e TESTENV -X gcov' - '[[ $TESTENV == *-cov ]] && codecov -e TESTENV -X gcov'
matrix: matrix:
exclude: exclude:
- os: linux - os: linux
env: TESTENV=py35 env: TESTENV=py35
- os: osx - os: osx
env: TESTENV=py34 env: TESTENV=py34-cov
- os: osx - os: osx
env: TESTENV=unittests-nodisp env: TESTENV=unittests-nodisp
- os: osx - os: osx

View File

@ -40,11 +40,11 @@ except ImportError:
TESTENV = os.environ['TESTENV'] TESTENV = os.environ['TESTENV']
TRAVIS_OS = os.environ.get('TRAVIS_OS_NAME', None) TRAVIS_OS = os.environ.get('TRAVIS_OS_NAME', None)
INSTALL_PYQT = TESTENV in ('py34', 'py35', 'unittests-nodisp', 'vulture', INSTALL_PYQT = TESTENV in ('py34', 'py35', 'py34-cov', 'py35-cov',
'pylint') 'unittests-nodisp', 'vulture', 'pylint')
XVFB = TRAVIS_OS == 'linux' and TESTENV == 'py34' XVFB = TRAVIS_OS == 'linux' and TESTENV == 'py34'
pip_packages = ['tox'] pip_packages = ['tox']
if TESTENV in ['py34', 'py35'] and TRAVIS_OS == 'linux': if TESTENV.endswith('-cov'):
pip_packages.append('codecov') pip_packages.append('codecov')

21
tox.ini
View File

@ -4,7 +4,7 @@
# and then run "tox" from this directory. # and then run "tox" from this directory.
[tox] [tox]
envlist = py34,py35,misc,vulture,pep257,flake8,pylint,pyroma,check-manifest envlist = py34,py35-cov,misc,vulture,pep257,flake8,pylint,pyroma,check-manifest
[testenv] [testenv]
# https://bitbucket.org/hpk42/tox/issue/246/ - only needed for Windows though # https://bitbucket.org/hpk42/tox/issue/246/ - only needed for Windows though
@ -44,6 +44,25 @@ deps =
wheel==0.26.0 wheel==0.26.0
xvfbwrapper==0.2.7 xvfbwrapper==0.2.7
cherrypy==4.0.0 cherrypy==4.0.0
commands =
{envpython} scripts/link_pyqt.py --tox {envdir}
{envpython} -m py.test --strict -rfEsw --faulthandler-timeout=70 --instafail {posargs:tests}
[testenv:py35-cov]
basepython = python3.5
setenv = {[testenv]setenv}
passenv = {[testenv]passenv}
deps = {[testenv]deps}
commands =
{envpython} scripts/link_pyqt.py --tox {envdir}
{envpython} -m py.test --strict -rfEsw --faulthandler-timeout=70 --instafail --cov --cov-report xml --cov-report=html --cov-report= {posargs:tests}
{envpython} scripts/dev/check_coverage.py {posargs}
[testenv:py34-cov]
basepython = python3.4
setenv = {[testenv]setenv}
passenv = {[testenv]passenv}
deps = {[testenv]deps}
commands = commands =
{envpython} scripts/link_pyqt.py --tox {envdir} {envpython} scripts/link_pyqt.py --tox {envdir}
{envpython} -m py.test --strict -rfEsw --faulthandler-timeout=70 --instafail --cov --cov-report xml --cov-report=html --cov-report= {posargs:tests} {envpython} -m py.test --strict -rfEsw --faulthandler-timeout=70 --instafail --cov --cov-report xml --cov-report=html --cov-report= {posargs:tests}