Repository navigation
ci(unit-tests): coverage combine can silently miss a worker's data file, under-reporting a PR's coverage - #1389
Merged
Merged
Conversation
Owner
Author
|
Cross-review verdict on
Notes, not blocking:
|
…le, under-reporting a PR's coverage - Run unit tests: the coverage leg logs every measured process and its parent (COVERAGE_DEBUG=pid,process to coverage-processes.log). - Report coverage: before combine, fail the step and post no total unless the controller and each xdist worker (its direct children) left a .coverage.* file; the expected set is derived from the run's own log. A missing or unreadable log fails the same way. - coverage.toml: add patch "_exit", so a worker ended by os._exit() (execnet's shutdown fallback, pytest-timeout's thread method) still saves. - Shift the unit-tests.yml line citations in workflows.rst/releasing.rst. tests/project passes: 397 passed, 1 skipped.
JarryShaw
force-pushed
the
w1387-coverage-guard
branch
from
October 7, 2026 23:19
2958401 to
8447c81
Compare
Owner
Author
|
Round-2 verdict on
Nits, not blocking:
|
Contributor
|
Coverage: 89.40% (unit tier, Python 3.14,
Per-file detail: the |
Owner
Author
|
The red |
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.
make pylint,make mypy,make isort) — not runmake testpasses, and a test case covers the change —tests/projectonly: 397 passed, 1 skippedWhat is the purpose of your pull request?
ci— workflows or build toolingCloses #1387
Guard (fails the step). The test step now logs every measured process with its parent (
COVERAGE_DEBUG=pid,process). Beforecombine,Report coveragefails and posts no total unless the controller and each of its direct children (the xdist workers) left a.coverage.*file. The set is read from the run's own log, so-n autoneeds no hard-coded count. A missing child of a worker is not flagged: the 20 duplicate-hash "skipped" files are such children. If the log names no worker, the check also fails, so it cannot pass while blind. Why fail rather than warn:coverage-comment.ymlaccepts only fourtestsvalues, so a warning marker would need an edit there. With no artifact, it already posts a notice and exits 0.Mechanism: still not traced. I ran 3 local
-n 4runs (2 pinned to 4 CPUs), and every worker saved each time (47 files). The one candidate I measured is mostly ruled out: xdist SIGKILLs a worker 10 s aftergw.exit(), but workers saved 2–3 ms after teardown began, and each save took about 0.3 s. Addingpatch = ["_exit"]covers the documentedos._exitpaths: execnet's shutdown fallback (gateway_base.py:1253) and pytest-timeout'sthreadmethod.sigterm = truewas not added, because nothing in the chain sends SIGTERM, and coverage.py's docs warn it can cause problems (issue 1310).Tests. New
tests/project/test_coverage_data_guard.py(8 tests) runs the extracted guard on synthetic logs and on a realcoverage runlog. All 8 pass. Mutation checks: the unpadded child regex, the round-1 guard on a missing log, and a warn-only guard each fail their test. The real-log test caught two parse bugs (New process: cmd:and space-padded pids). The guard also passed on all 3 real local runs. The citation shift (+25 lines) is inworkflows.rst/releasing.rst.