-
Notifications
You must be signed in to change notification settings - Fork 27
fix: include serial tests in coverage.xml and upload it from CI #373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
259c527
95d3b2d
0625cc9
c9c0b88
8474be9
44b4bcb
7600d9c
7d22164
eb12ff8
6b9046b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,8 +72,10 @@ test-integration-serial: # Run integration tests serially (for debugging) | |
| uv run pytest tests/integration/ -v -m integration | ||
|
|
||
| test-coverage: # Run tests with coverage report (parallel non-serial, then serial pass for state isolation) | ||
| uv run pytest tests/ -v -n auto -m "not serial" --cov=runpod_flash --cov-report=xml | ||
| uv run pytest tests/ -v -m "serial" --cov=runpod_flash --cov-append --cov-report=term-missing | ||
| uv run pytest tests/ -v -n auto -m "not serial" --cov=runpod_flash --cov-branch --cov-report=xml | ||
| # Re-emit the XML after appending the serial tests, or coverage.xml is left | ||
| # holding only the parallel run and undercounts. | ||
| uv run pytest tests/ -v -m "serial" --cov=runpod_flash --cov-branch --cov-append --cov-report=term-missing --cov-report=xml | ||
|
|
||
| test-coverage-serial: # Run tests with coverage report (serial execution) | ||
| uv run pytest tests/ -v --cov=runpod_flash --cov-report=term-missing | ||
|
|
@@ -124,10 +126,24 @@ ci-quality-github: # Quality checks with GitHub Actions formatting (parallel by | |
| uv run ruff check . --output-format=github | ||
| @echo "::endgroup::" | ||
| @echo "::group::Test suite with coverage (parallel non-serial)" | ||
| uv run pytest tests/ --junitxml=pytest-results-parallel.xml -v -n auto -m "not serial" --cov=runpod_flash --cov-report=xml --cov-fail-under=0 | ||
| uv run pytest tests/ --junitxml=pytest-results-parallel.xml -v -n auto -m "not serial" --cov=runpod_flash --cov-branch --cov-report=xml --cov-fail-under=0 | ||
| @echo "::endgroup::" | ||
| @echo "::group::Test suite with coverage (serial pass)" | ||
| uv run pytest tests/ --junitxml=pytest-results-serial.xml -v -m "serial" --cov=runpod_flash --cov-append --cov-report=term-missing | ||
| # Re-emit the XML after appending the serial tests, or coverage.xml is left | ||
| # holding only the parallel run and undercounts. | ||
| # | ||
| # This line, not the parallel one above, is the real coverage gate: the | ||
| # parallel invocation passes --cov-fail-under=0 to suppress the partial | ||
| # number, while this one inherits --cov-fail-under=65 from pyproject | ||
| # addopts. Do not "align" the two flags — that quietly disables the gate. | ||
| # | ||
| # Note also that make stops at the first failing recipe line, so if the | ||
| # parallel pass fails this re-emit never runs and coverage.xml holds the | ||
| # parallel subset. That is deliberate: guarding the parallel line with | ||
| # `-`/`|| true` so this always ran would let a red parallel suite exit 0. | ||
| # The weekly report only reads runs whose status is success, so an | ||
| # undercount on an already-failing run is not consumed by anything. | ||
| uv run pytest tests/ --junitxml=pytest-results-serial.xml -v -m "serial" --cov=runpod_flash --cov-branch --cov-append --cov-report=term-missing --cov-report=xml | ||
| @echo "::endgroup::" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The parallel invocation passes
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, documented. The comment now states that the serial line is the coverage gate and that aligning the two flags would quietly disable it. |
||
|
|
||
| ci-quality-github-serial: # Serial quality checks for GitHub Actions (for debugging) | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the parallel line above (
pytest ... -m "not serial") exits non-zero on any test failure,makeaborts before reaching this serial pass — so on a failing PRcoverage.xmlstill holds only the parallel subset and undercounts, which is the exact bug this change is fixing. The re-emit only takes effect when every parallel test passes. If the goal is an accurate number even on failing runs, the parallel invocation needs to not abort the recipe (e.g. a-/|| trueguard) so the serial re-emit always runs. Flagging in case the undercount-on-failure case is the one that matters.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed, and I've documented it — but I'd push back on the remedy. Guarding the parallel line with
-/|| truewould make the recipe's exit status come from the serial pass, so a red parallel suite could exit 0. Silently passing a failing suite is worse than an undercount on a run that already failed.The undercount is also unconsumed: the weekly report only reads runs whose status is
success, so a red run'scoverage.xmlis never read. The fix does what it needs to on green runs, which are the only ones that matter here. Written into the Makefile so the next reader doesn't have to re-derive it.