aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Ganssle <pganssle@users.noreply.github.com>2018-04-04 12:55:58 -0400
committerGitHub <noreply@github.com>2018-04-04 12:55:58 -0400
commit4f35713fe668858b9bf2c062be2994a9671e6660 (patch)
treef264f5c8ce9bc95145ec1632be5d7cc8dae6bf08
parent7d56dc12c196dc48fe30918fea7a6aac90182c89 (diff)
parent58d299de99612f76f2ff5cfe7fb142d95e5e8738 (diff)
downloadexternal_python_setuptools-4f35713fe668858b9bf2c062be2994a9671e6660.tar.gz
external_python_setuptools-4f35713fe668858b9bf2c062be2994a9671e6660.tar.bz2
external_python_setuptools-4f35713fe668858b9bf2c062be2994a9671e6660.zip
Merge pull request #1304 from pganssle/coverage
Set up code coverage
-rw-r--r--.codecov.yml1
-rw-r--r--.travis.yml14
-rw-r--r--appveyor.yml14
-rw-r--r--tests/requirements.txt2
-rw-r--r--tox.ini34
5 files changed, 56 insertions, 9 deletions
diff --git a/.codecov.yml b/.codecov.yml
new file mode 100644
index 00000000..69cb7601
--- /dev/null
+++ b/.codecov.yml
@@ -0,0 +1 @@
+comment: false
diff --git a/.travis.yml b/.travis.yml
index ffbd72a3..544b8df3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,8 +8,6 @@ python:
- 3.5
- &latest_py3 3.6
- nightly
-- pypy
-- pypy3
jobs:
fast_finish: true
@@ -23,6 +21,7 @@ jobs:
python: *latest_py3
install: skip
script: skip
+ after_success: skip
before_deploy: python bootstrap.py
deploy:
provider: pypi
@@ -35,6 +34,13 @@ jobs:
distributions: release
skip_cleanup: 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
@@ -48,4 +54,6 @@ install:
# update egg_info based on setup.py in checkout
- 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
diff --git a/appveyor.yml b/appveyor.yml
index 7c61455c..ff7122b4 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,10 +1,13 @@
environment:
- APPVEYOR: true
+ APPVEYOR: True
+ CODECOV_ENV: APPVEYOR_JOB_NAME
matrix:
- - PYTHON: "C:\\Python35-x64"
- - PYTHON: "C:\\Python27-x64"
+ - APPVEYOR_JOB_NAME: "python35-x64"
+ PYTHON: "C:\\Python35-x64"
+ - APPVEYOR_JOB_NAME: "python27-x64"
+ PYTHON: "C:\\Python27-x64"
install:
# symlink python from a directory with a space
@@ -20,6 +23,9 @@ cache:
test_script:
- "python bootstrap.py"
- "python -m pip install tox"
- - "tox"
+ - "tox -- --cov"
+
+after_test:
+ - tox -e coverage,codecov
version: '{build}'
diff --git a/tests/requirements.txt b/tests/requirements.txt
index 38b69247..fd826d09 100644
--- a/tests/requirements.txt
+++ b/tests/requirements.txt
@@ -5,3 +5,5 @@ virtualenv>=13.0.0
pytest-virtualenv>=1.2.7
pytest>=3.0.2
wheel
+coverage>=4.5.1
+pytest-cov>=2.5.1
diff --git a/tox.ini b/tox.ini
index 2f7d4dc8..a0c4cdf3 100644
--- a/tox.ini
+++ b/tox.ini
@@ -4,8 +4,38 @@
#
# export TOXENV='py27,py3{3,4,5,6},pypy,pypy3'
+[tox]
+envlist=python
+
[testenv]
deps=-rtests/requirements.txt
-passenv=APPDATA USERPROFILE HOMEDRIVE HOMEPATH windir APPVEYOR
-commands=py.test {posargs}
+setenv=COVERAGE_FILE={toxworkdir}/.coverage.{envname}
+# 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
+
+
+[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/*