summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Pradet <quentin@pradet.me>2018-08-20 17:25:23 +0400
committerSeth M. Larson <sethmichaellarson@gmail.com>2018-08-20 08:25:23 -0500
commit85e376a16d61a01d9c943870c48f3be8b8957223 (patch)
tree4b147264621b308fe5da19d5a9b7809f9653e4f9
parent23cd31453e2135ead4149470663eb478d05437ff (diff)
downloadurllib3-85e376a16d61a01d9c943870c48f3be8b8957223.tar.gz
Fix codecov coverage by collapsing paths in tox (#1428)
Inspired by https://github.com/pyca/cryptography/commit/62143e47077b8df78e926da5c8f027d8f01ab281
-rw-r--r--.coveragerc9
-rw-r--r--dev-requirements.txt1
-rw-r--r--tox.ini8
3 files changed, 14 insertions, 4 deletions
diff --git a/.coveragerc b/.coveragerc
index 985166ec..8754a1e1 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -1,6 +1,6 @@
[run]
-include =
- *urllib3/*
+source =
+ urllib3
omit =
*urllib3/packages/*
@@ -10,6 +10,11 @@ omit =
*urllib3/contrib/securetransport.py
*urllib3/contrib/_securetransport/*
+[paths]
+source =
+ src/urllib3
+ .tox/*/site-packages/urllib3
+
[report]
exclude_lines =
except ImportError:
diff --git a/dev-requirements.txt b/dev-requirements.txt
index d0505e8e..356b84d4 100644
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -7,7 +7,6 @@ tornado==5.0.2; python_version>"2.6"
tornado==4.2.1; python_version<="2.6"
PySocks==1.6.8
pkginfo==1.4.2
-pytest-cov==2.5.1
pytest-timeout==1.3.1; python_version>"2.6"
pytest-timeout==1.2.0; python_version<="2.6"
pytest==3.6.4; python_version>"2.6"
diff --git a/tox.ini b/tox.ini
index 05e92f57..d52d8730 100644
--- a/tox.ini
+++ b/tox.ini
@@ -9,7 +9,13 @@ commands=
pip --version
python --version
python -c "import struct; print(struct.calcsize('P') * 8)"
- py.test -r sx --cov=urllib3 --cov-config={toxinidir}/.coveragerc test {posargs}
+ # Inspired from https://github.com/pyca/cryptography
+ # We use parallel mode and then combine here so that coverage.py will take
+ # the paths like .tox/pyXY/lib/pythonX.Y/site-packages/urllib3/__init__.py
+ # and collapse them into src/urllib3/__init__.py.
+ coverage run --parallel-mode -m pytest -r sx test {posargs}
+ coverage combine
+ coverage report -m
setenv =
PYTHONWARNINGS=always::DeprecationWarning
passenv = CFLAGS LDFLAGS TRAVIS APPVEYOR CRYPTOGRAPHY_OSX_NO_LINK_FLAGS