CI: Split off separate coverage job#3005
Merged
Conversation
c505fe5 to
9db05d6
Compare
After moving tests into subdirectories in, coverage.py consistently reported 0% coverage due to a conflict between pytest-cov and the new test package structure. Changes: - Replace `pytest --cov` with `coverage run -m pytest` - Add `relative_files = true` to coverage configuration - Split coverage into dedicated CI job (Ubuntu 3.14 only) - Remove coverage overhead from cross-platform test runs Fixes mesa#3004
9db05d6 to
73c8a9c
Compare
This reverts commit e76468e.
Member
Author
|
For some reason replacing Merging to resolve, but still curious about the root cause. |
Member
|
Great to see it fixed and no idea here either about what's going on. |
EwoutH
pushed a commit
that referenced
this pull request
Dec 27, 2025
## Summary Improves coverage collection after test reorganization in #2994 by adopting `pytest`'s native coverage integration and measuring all code including tests. ## Problem After moving tests into nested subdirectories, coverage.py reported 0% coverage. The root cause was a combination of: 1. Path resolution issues with nested test packages 2. Tests not being measured in coverage reports ## Solution This PR implements reviewer feedback to adopt coverage best practices: ### Configuration Changes (`pyproject.toml`): - **Added `source = ["."]`**: Measures all code in the project directory - **Kept `source_pkgs = ["mesa"]`**: Specifically tracks the mesa package - **Added `relative_files = true`**: Fixes path resolution for nested directories - **Removed `omit = ["tests/*"]`**: Now measures test coverage (critical for verifying all tests run) - **Added `[tool.coverage.paths]`**: Maps installed package paths for accurate coverage reporting ### CI Changes (`.github/workflows/build_lint.yml`): - **Replaced** `coverage run -m pytest` + `coverage xml` (2 commands from #3005) - **With** `python -Im pytest -p pytest_cov --cov --cov-report=xml --cov-report=markdown-append:"${GITHUB_STEP_SUMMARY}" --cov-context=test tests/` (single command) - **Benefits**: - `-Im` flag ensures testing installed package, not git checkout - `-p pytest_cov` loads plugin early to avoid import issues - `--cov` (no value) measures everything per coverage config - Markdown report appears in GitHub Actions summary (better UX) - `--cov-context=test` enables per-test coverage tracking --------- Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After moving tests into subdirectories in, coverage.py consistently reported 0% coverage due to a conflict between pytest-cov and the new test package structure.
Changes:
pytest --covwithcoverage run -m pytestThis is a workaround for #3004.