Skip to content

fix(ci): set COVERAGE_FILE so unit coverage uploads correctly#1223

Merged
LalatenduMohanty merged 1 commit into
python-wheel-build:mainfrom
LalatenduMohanty:fix/coverage-gate-1222
Jun 29, 2026
Merged

fix(ci): set COVERAGE_FILE so unit coverage uploads correctly#1223
LalatenduMohanty merged 1 commit into
python-wheel-build:mainfrom
LalatenduMohanty:fix/coverage-gate-1222

Conversation

@LalatenduMohanty

@LalatenduMohanty LalatenduMohanty commented Jun 29, 2026

Copy link
Copy Markdown
Member

The switch from coverage run -m pytest to pytest --cov (#1219)
caused pytest-cov to write a single .coverage file. The CI upload
step uses the glob .coverage.*, which requires a suffix after the
dot — so the unit test coverage data was never uploaded. Only e2e
coverage data (which still produces .coverage.* files via subprocess
instrumentation) reached the combine step, dropping overall coverage
from ~93% to 37% and failing the --fail-under=60 gate.

Fix by setting COVERAGE_FILE with a per-job suffix so pytest-cov
writes directly to e.g. .coverage.unit.py3.12.ubuntu-latest, which
the upload glob matches.

Also remove tests/ from [tool.coverage.run].source to measure
only production code coverage.

Closes: #1222

@LalatenduMohanty LalatenduMohanty requested a review from a team as a code owner June 29, 2026 17:23
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The CI workflow sets COVERAGE_FILE to a matrix-specific filename (including Python version and OS) in the unit test job, ensuring each matrix combination writes a uniquely named coverage file that matches the .coverage.* upload glob. The pyproject.toml coverage path configuration replaces the tests/ path mapping with a .hatch/**/site-packages/fromager mapping to correctly resolve paths from hatch-installed package environments.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the CI coverage-file fix and matches the main change.
Linked Issues check ✅ Passed The changes address the broken coverage gate by generating uploadable per-job coverage files and updating coverage path handling.
Out of Scope Changes check ✅ Passed The diff stays within CI coverage handling and coverage config, with no unrelated changes.
Description check ✅ Passed The description clearly matches the coverage-file and coverage-source changes in the pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mergify mergify Bot added the ci label Jun 29, 2026
The switch from `coverage run -m pytest` to `pytest --cov` (python-wheel-build#1219)
caused pytest-cov to write a single `.coverage` file. The CI upload
step uses the glob `.coverage.*`, which requires a suffix after the
dot — so the unit test coverage data was never uploaded. Only e2e
coverage data (which still produces `.coverage.*` files via subprocess
instrumentation) reached the combine step, dropping overall coverage
from ~93% to 37% and failing the `--fail-under=60` gate.

Fix by setting `COVERAGE_FILE` with a per-job suffix so pytest-cov
writes directly to e.g. `.coverage.unit.py3.12.ubuntu-latest`, which
the upload glob matches.

Also remove `tests/` from `[tool.coverage.run].source` to measure
only production code coverage.

Closes: python-wheel-build#1222
Co-Authored-By: Claude <claude@anthropic.com>
Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
@LalatenduMohanty LalatenduMohanty force-pushed the fix/coverage-gate-1222 branch from 55310ac to 03af7a5 Compare June 29, 2026 17:27
Comment thread pyproject.toml
@LalatenduMohanty LalatenduMohanty merged commit cc322cd into python-wheel-build:main Jun 29, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ci): coverage gate broken on main since pytest-cov switch

2 participants