Skip to content

Commit 382c736

Browse files
authored
Merge pull request #2224 from pypa/better-cov
Improve coverage configuration
2 parents 2a55538 + c897b90 commit 382c736

File tree

5 files changed

+19
-31
lines changed

5 files changed

+19
-31
lines changed

.coveragerc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[run]
2+
source=
3+
pkg_resources
4+
setuptools
5+
omit=
6+
*/_vendor/*
7+
8+
[report]

.github/workflows/python-tests.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,3 @@ jobs:
9898
python -m
9999
tox
100100
--parallel auto
101-
--
102-
--cov

.travis.yml

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ jobs:
55
fast_finish: true
66
include:
77
- python: pypy3
8-
env: DISABLE_COVERAGE=1 # Don't run coverage on pypy (too slow).
98
- python: 3.5
109
- python: 3.6
1110
- python: 3.7
@@ -15,12 +14,12 @@ jobs:
1514
env: LANG=C
1615
- python: 3.8-dev
1716
- <<: *latest_py3
18-
env: TOXENV=docs DISABLE_COVERAGE=1
17+
env: TOXENV=docs
1918
allow_failures:
2019
# suppress failures due to pypa/setuptools#2000
2120
- python: pypy3
2221
- <<: *latest_py3
23-
env: TOXENV=docs DISABLE_COVERAGE=1
22+
env: TOXENV=docs
2423

2524
cache: pip
2625

@@ -39,22 +38,8 @@ install:
3938

4039
script:
4140
- export NETWORK_REQUIRED=1
42-
- |
43-
( # Run testsuite.
44-
if [ -z "$DISABLE_COVERAGE" ]
45-
then
46-
tox -- --cov
47-
else
48-
tox
49-
fi
50-
)
41+
- tox
5142

5243
after_success:
53-
- |
54-
( # Upload coverage data.
55-
if [ -z "$DISABLE_COVERAGE" ]
56-
then
57-
export TRAVIS_JOB_NAME="${TRAVIS_PYTHON_VERSION} (LANG=$LANG)" CODECOV_ENV=TRAVIS_JOB_NAME
58-
tox -e coverage,codecov
59-
fi
60-
)
44+
- export TRAVIS_JOB_NAME="${TRAVIS_PYTHON_VERSION} (LANG=$LANG)" CODECOV_ENV=TRAVIS_JOB_NAME
45+
- tox -e coverage,codecov

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[pytest]
2-
addopts=--doctest-modules --flake8 --doctest-glob=pkg_resources/api_tests.txt -r sxX
2+
addopts=--doctest-modules --flake8 --doctest-glob=pkg_resources/api_tests.txt --cov -r sxX
33
norecursedirs=dist build *.egg setuptools/extern pkg_resources/extern pkg_resources/tests/data tools .* setuptools/_vendor pkg_resources/_vendor
44
doctest_optionflags=ELLIPSIS ALLOW_UNICODE
55
filterwarnings =

tox.ini

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,16 @@ setenv =
2323
# TODO: The passed environment variables came from copying other tox.ini files
2424
# These should probably be individually annotated to explain what needs them.
2525
passenv=APPDATA HOMEDRIVE HOMEPATH windir Program* CommonProgram* VS* APPVEYOR APPVEYOR_* CI CODECOV_* TRAVIS TRAVIS_* NETWORK_REQUIRED
26-
commands=pytest --cov-config={toxinidir}/tox.ini --cov-report= {posargs}
26+
commands = pytest {posargs}
2727
usedevelop=True
2828
extras =
2929
tests
3030

3131

32+
[testenv:pypy{,3}]
33+
commands = pytest --no-cov {posargs}
34+
35+
3236
[testenv:coverage]
3337
description=Combine coverage data and create report
3438
deps=coverage
@@ -53,13 +57,6 @@ changedir = docs
5357
commands =
5458
python -m sphinx . {toxinidir}/build/html
5559

56-
[coverage:run]
57-
source=
58-
pkg_resources
59-
setuptools
60-
omit=
61-
*/_vendor/*
62-
6360
[testenv:finalize]
6461
skip_install = True
6562
deps =

0 commit comments

Comments
 (0)