test: the stats collector counts only the call phase - #562
Open
espressolee wants to merge 1 commit into
Open
Conversation
5f3911d made pytest_runtest_makereport ignore the setup and teardown reports (boxed#544) but added no test. Drive the collector's hooks with synthetic reports for all three phases and check that only the call duration is recorded. Against the fix's parent the test records 0.91 instead of 0.01; with the fix it passes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
nicklafleur
approved these changes
Sep 3, 2026
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.
5f3911d fixed #544:
pytest_runtest_makereportfires for setup, call and teardown, and the stats collector was adding all three toduration_by_test, inflating the recorded duration used by the per-mutant timeout calculation. It merged without a test.This adds one. The collector is local to
run_stats(), so the test intercepts the pluginrun_stats()hands to pytest and feeds its hooks synthetic setup/call/teardown reports; no sleeps, no wall clock.Against
dc58270d(the fix's parent) the test fails with0.91, because setup, call and teardown are summed. Against5f3911d1it passes with0.01.Full-suite result on the fixed tree: 359 passed, 1 skipped, 2 environment-dependent failures (missing
pyrefly; a platform probe whose expected subprocess crash did not occur here).