Skip to content

Commit 6baf3d3

Browse files
committed
Add */src to coverage paths
For mac and windows tests, the path is no longer matching against `*/site-packages`. Not sure what about uv has changed this.
1 parent 4b04cf4 commit 6baf3d3

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

.github/workflows/python-tests.yml

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ name: "python tests and coverage"
44
# https://github.com/actions/checkout : 11bd71901bbe5b1630ceea73d27597364c9af683
55
# https://github.com/actions/download-artifact : fa0a91b85d4f404e444e00e005971372dc801d16
66
# https://github.com/actions/upload-artifact : 6f51ac03b9356f520e9adb1b1b7802705f340c2b
7+
# https://github.com/astral-sh/setup-uv : 1edb52594c857e2b5b13128931090f0640537287
78

89
on:
910
pull_request:
@@ -14,8 +15,8 @@ on:
1415
- "main"
1516

1617
env:
18+
UV_PYTHON_PREFERENCE: "only-system"
1719
UV_LOCKED: "true"
18-
UV_SYSTEM_PYTHON: "true"
1920

2021
jobs:
2122
run-tests-and-coverage:
@@ -45,9 +46,12 @@ jobs:
4546
python-version: "${{ matrix.python-version }}"
4647
allow-prereleases: true
4748

48-
- name: "Install uv"
49-
run: |
50-
python -m pip install --upgrade pip uv
49+
- name: "Install the latest version of uv"
50+
uses: "astral-sh/setup-uv@1edb52594c857e2b5b13128931090f0640537287"
51+
with:
52+
version: "latest"
53+
python-version: "${{ matrix.python-version }}"
54+
enable-cache: true
5155

5256
- name: "Run tests and coverage via nox"
5357
run: |
@@ -74,19 +78,25 @@ jobs:
7478
with:
7579
python-version: "3.12"
7680

77-
- name: "Install uv"
78-
run: |
79-
python -m pip install --upgrade pip uv
81+
- name: "Install the latest version of uv"
82+
uses: "astral-sh/setup-uv@1edb52594c857e2b5b13128931090f0640537287"
83+
with:
84+
version: "latest"
85+
python-version: "3.12"
86+
enable-cache: true
8087

8188
- name: "Download coverage artifacts"
8289
uses: "actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16"
8390
with:
8491
pattern: "coverage-artifact-*"
8592
merge-multiple: true
8693

87-
- name: "Compile coverage data, print report"
94+
- name: "Compile coverage data"
8895
run: |
8996
uv run nox --session coverage_combine
97+
98+
- name: "Post summary to step summary."
99+
run: |
90100
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
91101
echo "TOTAL=$TOTAL" >> $GITHUB_ENV
92102
echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY
@@ -103,9 +113,12 @@ jobs:
103113
with:
104114
python-version: "3.12"
105115

106-
- name: "Install uv"
107-
run: |
108-
python -m pip install --upgrade pip uv
116+
- name: "Install the latest version of uv"
117+
uses: "astral-sh/setup-uv@1edb52594c857e2b5b13128931090f0640537287"
118+
with:
119+
version: "latest"
120+
python-version: "3.12"
121+
enable-cache: true
109122

110123
- name: "Enforce strict type annotations with mypy"
111124
run: |

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ source = ["tests"]
7979
source_pkgs = ["module_name"]
8080

8181
[tool.coverage.paths]
82-
source = ["src/", "*/site-packages"]
82+
source = ["src/", "*/site-packages", "*/src"]
8383
test = ["tests/", "*/tests"]
8484

8585
[tool.coverage.report]

0 commit comments

Comments
 (0)