Commit 58d299de authored by Benoit Pierre's avatar Benoit Pierre Committed by Paul Ganssle

Improve speed and clarity of code coverage

Rationale:
- tox should work the same as before
- coverage is too slow and disabled by default locally
- disable coverage on pypy and pypy3 (way too slow)
- add coverage info for pkg_resources
- make sure tests are ignored in coverage
- make sure all CI jobs are identifiable
- include coverage for xfail (too complicated otherwise)
- disable report on terminal
parent 685987d6
...@@ -8,29 +8,20 @@ python: ...@@ -8,29 +8,20 @@ python:
- 3.5 - 3.5
- &latest_py3 3.6 - &latest_py3 3.6
- nightly - nightly
- pypy
env:
TOXENV=py
jobs: jobs:
fast_finish: true fast_finish: true
include: include:
- python: *latest_py3 - python: *latest_py3
env: &cenv env: LANG=C
global:
- LANG=C
- TOXENV=py
- python: *latest_py2 - python: *latest_py2
env: *cenv env: LANG=C
- python: pypy3
# Running coverage breaks the pypy3 build on Travis only.
# Until that's fixed the pypy3 build needs to be run without coverage
script: tox -e py -- $TRAVIS_BUILD_DIR
- stage: deploy (to PyPI for tagged commits) - stage: deploy (to PyPI for tagged commits)
if: tag IS present if: tag IS present
python: *latest_py3 python: *latest_py3
install: skip install: skip
script: skip script: skip
after_success: skip
before_deploy: python bootstrap.py before_deploy: python bootstrap.py
deploy: deploy:
provider: pypi provider: pypi
...@@ -43,6 +34,13 @@ jobs: ...@@ -43,6 +34,13 @@ jobs:
distributions: release distributions: release
skip_cleanup: true skip_cleanup: true
skip_upload_docs: true skip_upload_docs: true
# Don't run coverage on pypy.
- python: pypy
script: tox
after_success: skip
- python: pypy3
script: tox
after_success: skip
cache: pip cache: pip
...@@ -56,8 +54,6 @@ install: ...@@ -56,8 +54,6 @@ install:
# update egg_info based on setup.py in checkout # update egg_info based on setup.py in checkout
- python bootstrap.py - python bootstrap.py
script: tox script: tox -- --cov
after_success:
- if [[ $TOXENV == "py" ]]; then tox -e coverage,codecov; fi
after_success: env TRAVIS_JOB_NAME="${TRAVIS_PYTHON_VERSION} (LANG=$LANG)" CODECOV_ENV=TRAVIS_JOB_NAME tox -e coverage,codecov
environment: environment:
APPVEYOR: True APPVEYOR: True
CODECOV_ENV: APPVEYOR_JOB_NAME
matrix: matrix:
- PYTHON: "C:\\Python35-x64" - APPVEYOR_JOB_NAME: "python35-x64"
- PYTHON: "C:\\Python27-x64" PYTHON: "C:\\Python35-x64"
- APPVEYOR_JOB_NAME: "python27-x64"
PYTHON: "C:\\Python27-x64"
install: install:
# symlink python from a directory with a space # symlink python from a directory with a space
...@@ -20,10 +23,9 @@ cache: ...@@ -20,10 +23,9 @@ cache:
test_script: test_script:
- "python bootstrap.py" - "python bootstrap.py"
- "python -m pip install tox" - "python -m pip install tox"
- "tox -e py" - "tox -- --cov"
after_test: after_test:
- tox -e coverage,codecov - tox -e coverage,codecov
version: '{build}' version: '{build}'
...@@ -4,28 +4,28 @@ ...@@ -4,28 +4,28 @@
# #
# export TOXENV='py27,py3{3,4,5,6},pypy,pypy3' # export TOXENV='py27,py3{3,4,5,6},pypy,pypy3'
[tox]
envlist=python
[testenv] [testenv]
deps=-rtests/requirements.txt deps=-rtests/requirements.txt
setenv=COVERAGE_FILE={toxworkdir}/.coverage.{envname} setenv=COVERAGE_FILE={toxworkdir}/.coverage.{envname}
# TODO: The passed environment variables came from copying other tox.ini files # TODO: The passed environment variables came from copying other tox.ini files
# These should probably be individually annotated to explain what needs them. # These should probably be individually annotated to explain what needs them.
passenv=APPDATA HOMEDRIVE HOMEPATH windir APPVEYOR APPVEYOR_* CI CODECOV_* TRAVIS TRAVIS_* passenv=APPDATA HOMEDRIVE HOMEPATH windir APPVEYOR APPVEYOR_* CI CODECOV_* TRAVIS TRAVIS_*
# These are separate so xfail tests don't count towards code coverage commands=pytest --cov-config={toxinidir}/tox.ini --cov-report= {posargs}
commands=pytest -m "not xfail" {posargs: "{toxinidir}" --cov-config={toxinidir}/tox.ini --cov=setuptools}
pytest -m "xfail" {posargs: "{toxinidir}"}
usedevelop=True usedevelop=True
[testenv:coverage] [testenv:coverage]
description=Combine coverage data and create reports description=Combine coverage data and create report
deps=coverage deps=coverage
skip_install=True skip_install=True
changedir={toxworkdir} changedir={toxworkdir}
setenv=COVERAGE_FILE=.coverage setenv=COVERAGE_FILE=.coverage
commands=coverage erase commands=coverage erase
coverage combine coverage combine
coverage report --rcfile={toxinidir}/tox.ini coverage {posargs:xml}
coverage xml
[testenv:codecov] [testenv:codecov]
description=[Only run on CI]: Upload coverage data to codecov description=[Only run on CI]: Upload coverage data to codecov
...@@ -34,9 +34,8 @@ skip_install=True ...@@ -34,9 +34,8 @@ skip_install=True
commands=codecov --file {toxworkdir}/coverage.xml commands=codecov --file {toxworkdir}/coverage.xml
[coverage:run] [coverage:run]
source=setuptools source=
omit=*/_vendor/* pkg_resources
setuptools
[coverage:report] omit=
skip_covered=True */_vendor/*
show_missing=True
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment