Skip to content

test: the stats collector counts only the call phase - #562

Open
espressolee wants to merge 1 commit into
boxed:mainfrom
espressolee:test-stats-call-phase
Open

test: the stats collector counts only the call phase#562
espressolee wants to merge 1 commit into
boxed:mainfrom
espressolee:test-stats-call-phase

Conversation

@espressolee

Copy link
Copy Markdown
Contributor

5f3911d fixed #544: pytest_runtest_makereport fires for setup, call and teardown, and the stats collector was adding all three to duration_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 plugin run_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 with 0.91, because setup, call and teardown are summed. Against 5f3911d1 it passes with 0.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).

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

run_stats records the teardown duration per test (missing call.when filter), starving the per-mutant timeout budget

2 participants