Fix codecov coverage by collapsing paths in tox
Inspired by
MODIFY
.coveragerc
.coveragerc
[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:

MODIFY
dev-requirements.txt
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"

MODIFY
tox.ini
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

Fix codecov coverage by collapsing paths in tox (#1428)

Inspired by https://github.com/pyca/cryptography/commit/62143e47077b8df78e926da5c8f027d8f01ab281