Skip to content

Commit 4b5baaa

Browse files
committed
Allow codecov to correctly find file paths
1 parent e266be8 commit 4b5baaa

File tree

5 files changed

+81
-21
lines changed

5 files changed

+81
-21
lines changed

.codecov.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@ comment: false
22
coverage:
33
status:
44
project:
5-
threshold: 0.5%
5+
default:
6+
threshold: 0.5%
7+
fixes:
8+
- "src/::" # reduce root e.g., "src/setuptools/" => "setuptools/"

.coveragerc

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,31 @@
11
[run]
2+
source_pkgs =
3+
setuptools
4+
pkg_resources
25
omit =
36
# leading `*/` for pytest-dev/pytest-cov#456
4-
*/.tox/*
7+
*/_vendor/*
8+
*/_distutils/*
9+
*/tests/*
10+
*/test_*/*
11+
*/pip-run-*/*
12+
*/pip-build*/*
13+
*/pip-req-build*/*
14+
*/pip-standalone*/*
15+
/tmp/easy_install*/*
16+
/tmp/tmp*/setup.py
17+
18+
[paths]
19+
setuptools =
20+
setuptools/
21+
*/site-packages/setuptools/
22+
*/pip-install-*/setuptools_*/setuptools/
23+
*/tmp*/setuptools
24+
pkg_resources =
25+
pkg_resources/
26+
*/site-packages/pkg_resources/
27+
*/pip-install-*/setuptools_*/pkg_resources/
28+
*/tmp*/pkg_resources
529

630
[report]
731
show_missing = True

.coveragerc.ci

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[run]
2+
source_pkgs =
3+
setuptools
4+
pkg_resources
5+
omit =
6+
# leading `*/` for pytest-dev/pytest-cov#456
7+
*/_vendor/*
8+
*/_distutils/*
9+
*/tests/*
10+
*/test_*
11+
12+
[paths]
13+
setuptools =
14+
src/setuptools/
15+
*/site-packages/setuptools/
16+
*/pip-install-*/setuptools_*/setuptools/
17+
*/tmp*/setuptools
18+
pkg_resources =
19+
src/pkg_resources/
20+
*/site-packages/pkg_resources/
21+
*/pip-install-*/setuptools_*/pkg_resources/
22+
*/tmp*/pkg_resources
23+
24+
[report]
25+
show_missing = True

.github/workflows/main.yml

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ jobs:
6565
run: |
6666
python -m pip install tox
6767
- name: Run tests
68-
run: |
69-
python -m tox
68+
run: python -m tox -- --cov-report xml --cov-report term
7069

7170
test:
7271
needs: prepare
@@ -103,14 +102,15 @@ jobs:
103102
- name: Isolate tests to avoid PYTHONPATH interference
104103
run: |
105104
# Avoid problems with import paths, see #2318, #3015:
105+
# `mkdir` `git rm` and `git mv` are OS-independent commands
106106
git mv setuptools/tests test_setuptools
107107
git mv pkg_resources/tests test_pkg_resources
108108
# Prevent local directories to take precedence over installed packages:
109-
git rm -rf _distutils_hack
110-
git rm -rf setuptools
111-
git rm -rf pkg_resources
112-
# `git rm` and `git mv` are OS-independent commands
113-
- name: Retrieve pre-built distribution archive
109+
mkdir src
110+
git mv _distutils_hack src
111+
git mv setuptools src
112+
git mv pkg_resources src
113+
- name: Retrieve pre-built distribution files
114114
uses: actions/download-artifact@v2
115115
with:
116116
name: python-distribution-files
@@ -127,9 +127,8 @@ jobs:
127127
run: >-
128128
python -m tox
129129
--installpkg '${{ needs.prepare.outputs.wheel-distribution }}'
130-
-- --cov-report xml
130+
-- --cov-report xml --cov-report term --cov-config .coveragerc.ci
131131
- name: Publish coverage
132-
if: false # disabled for #2727
133132
uses: codecov/codecov-action@v1
134133
with:
135134
flags: >- # Mark which lines are covered by which envs
@@ -168,14 +167,15 @@ jobs:
168167
shell: C:\cygwin\bin\env.exe CYGWIN_NOWINPATH=1 CHERE_INVOKING=1 C:\cygwin\bin\bash.exe -leo pipefail -o igncr {0}
169168
run: |
170169
# Avoid problems with import paths, see #2318, #3015:
170+
# `mkdir` `git rm` and `git mv` are OS-independent commands
171171
git mv setuptools/tests test_setuptools
172172
git mv pkg_resources/tests test_pkg_resources
173173
# Prevent local directories to take precedence over installed packages:
174-
git rm -rf _distutils_hack
175-
git rm -rf setuptools
176-
git rm -rf pkg_resources
177-
# `git rm` and `git mv` are OS-independent commands
178-
- name: Retrieve pre-built distribution archive
174+
mkdir src
175+
git mv _distutils_hack src
176+
git mv setuptools src
177+
git mv pkg_resources src
178+
- name: Retrieve pre-built distribution files
179179
uses: actions/download-artifact@v2
180180
with:
181181
name: python-distribution-files
@@ -185,7 +185,13 @@ jobs:
185185
run: >-
186186
python -m tox
187187
--installpkg '${{ needs.prepare.outputs.wheel-distribution }}'
188-
-- --cov-report xml
188+
-- --cov-report xml --cov-report term --cov-config .coveragerc.ci
189+
- name: Publish coverage
190+
uses: codecov/codecov-action@v1
191+
with:
192+
flags: >- # Mark which lines are covered by which envs
193+
cygwin
194+
${{ matrix.python }}
189195
190196
integration-test:
191197
strategy:
@@ -224,13 +230,14 @@ jobs:
224230
- name: Isolate tests to avoid PYTHONPATH interference
225231
run: |
226232
# Avoid problems with import paths, see #2318, #3015:
233+
# `mkdir` `git rm` and `git mv` are OS-independent commands
227234
git mv setuptools/tests test_setuptools
228235
git mv pkg_resources/tests test_pkg_resources
229236
# Prevent local directories to take precedence over installed packages:
230-
git rm -rf _distutils_hack
231-
git rm -rf setuptools
232-
git rm -rf pkg_resources
233-
# `git rm` and `git mv` are OS-independent commands
237+
mkdir src
238+
git mv _distutils_hack src
239+
git mv setuptools src
240+
git mv pkg_resources src
234241
- name: Retrieve pre-built distribution files
235242
uses: actions/download-artifact@v2
236243
with:

conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def pytest_configure(config):
2222

2323

2424
collect_ignore = [
25+
'src',
2526
'tests/manual_test.py',
2627
'setuptools/_distutils',
2728
'_distutils_hack',

0 commit comments

Comments
 (0)