Commit 4f35713f authored by Paul Ganssle's avatar Paul Ganssle Committed by GitHub

Merge pull request #1304 from pganssle/coverage

Set up code coverage
parents 7d56dc12 58d299de
comment: false
...@@ -8,8 +8,6 @@ python: ...@@ -8,8 +8,6 @@ python:
- 3.5 - 3.5
- &latest_py3 3.6 - &latest_py3 3.6
- nightly - nightly
- pypy
- pypy3
jobs: jobs:
fast_finish: true fast_finish: true
...@@ -23,6 +21,7 @@ jobs: ...@@ -23,6 +21,7 @@ jobs:
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
...@@ -35,6 +34,13 @@ jobs: ...@@ -35,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
...@@ -48,4 +54,6 @@ install: ...@@ -48,4 +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: 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,6 +23,9 @@ cache: ...@@ -20,6 +23,9 @@ cache:
test_script: test_script:
- "python bootstrap.py" - "python bootstrap.py"
- "python -m pip install tox" - "python -m pip install tox"
- "tox" - "tox -- --cov"
after_test:
- tox -e coverage,codecov
version: '{build}' version: '{build}'
...@@ -5,3 +5,5 @@ virtualenv>=13.0.0 ...@@ -5,3 +5,5 @@ virtualenv>=13.0.0
pytest-virtualenv>=1.2.7 pytest-virtualenv>=1.2.7
pytest>=3.0.2 pytest>=3.0.2
wheel wheel
coverage>=4.5.1
pytest-cov>=2.5.1
...@@ -4,8 +4,38 @@ ...@@ -4,8 +4,38 @@
# #
# 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
passenv=APPDATA USERPROFILE HOMEDRIVE HOMEPATH windir APPVEYOR setenv=COVERAGE_FILE={toxworkdir}/.coverage.{envname}
commands=py.test {posargs} # TODO: The passed environment variables came from copying other tox.ini files
# These should probably be individually annotated to explain what needs them.
passenv=APPDATA HOMEDRIVE HOMEPATH windir APPVEYOR APPVEYOR_* CI CODECOV_* TRAVIS TRAVIS_*
commands=pytest --cov-config={toxinidir}/tox.ini --cov-report= {posargs}
usedevelop=True usedevelop=True
[testenv:coverage]
description=Combine coverage data and create report
deps=coverage
skip_install=True
changedir={toxworkdir}
setenv=COVERAGE_FILE=.coverage
commands=coverage erase
coverage combine
coverage {posargs:xml}
[testenv:codecov]
description=[Only run on CI]: Upload coverage data to codecov
deps=codecov
skip_install=True
commands=codecov --file {toxworkdir}/coverage.xml
[coverage:run]
source=
pkg_resources
setuptools
omit=
*/_vendor/*
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