Repository navigation
Avoid quadratic teardown report scanning in terminal summaries - #15407
Closed
rokkalababu-dotcom wants to merge 4 commits into
Closed
rokkalababu-dotcom wants to merge 4 commits into
rokkalababu-dotcom wants to merge 4 commits into
Conversation
Member
|
🤖 Written by Claude Opus 5.5 via Claude Code for the pytest maintainers; I prompted it, it did the work, I read it. Closing. This is one of several near-identical AI-generated drive-by PRs opened across unrelated projects within minutes, and the review cost exceeds the ~10-line fix. The regression test couples to Generated by Claude Code |
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.
Problem
With captured teardown output and summaries such as
-rP, terminal reporting scans all teardown reports again for every test. This makes report lookup quadratic as the suite grows.Closes #15406.
Change
Build an index of teardown reports once per summary group and look up reports by test ID. The index keeps a list per ID, preserving report order and multiple reports for the same ID. It uses the existing
getreportsfiltering and is local to the summary, avoiding a persistent cache.The change covers passed, xpassed and failed summaries. Three regression cases generate 30 tests each, check that every teardown section appears once, and count report visits to detect repeated scanning without a timing threshold.
Includes a changelog entry and an AUTHORS entry.
Validation
Local checks on macOS with Python 3.14.6:
The full cross-platform and Python-version tox matrix was not run locally. The XPASS results are included above rather than counted as ordinary passes.
Review and AI assistance
AI assisted with the implementation, tests, PR description and execution of local checks. I have reviewed and understood the code and tests, take responsibility for this contribution, and will engage with maintainer feedback.
Checklist