Repository navigation
Fix last-failed cache for unittest subtest failures - #15168
Open
Kerim-Sabic wants to merge 1 commit into
Open
Kerim-Sabic wants to merge 1 commit into
Kerim-Sabic wants to merge 1 commit into
Conversation
AI assistance: Codex helped investigate, implement, and validate this change. Kerim Sabic confirmed an in-depth review before upstream submission.
This branch has not been deployed
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.
Failed
unittest.TestCase.subTestchecks can disappear from the last-failed cache when a later subtest or the parent's call report passes. Consequently,--last-failed --lfnf=nonecan deselect a test that still fails.Keep failures from
SubtestReportuntil the parent call report has been processed. Consume the per-execution marker so a subsequent successful execution of the same node ID still clears its cached failure.Closes #14575.
The regression tests cover passing and skipped reports after a failure, errors inside subtests, a skipped parent, operation without terminal reporting, rerunning with
--last-failed, clearing the cache after repair, and repeated execution of one node ID.Validation on Windows / Python 3.13.5:
tox -e linting: passed.git diff --cached --check: passed.tox -e py313 -- -n 4 --basetemp=../pytest-test-tmp/full-py313-final: 4,615 passed, 145 skipped, 13 xfailed, 1 xpassed, and 1 failed. All 11 added regression cases passed.test_fixture_doctest_skip_has_line_number, also fails at unchanged base commitaec0291ed14c724873bfcea99d5dfd739f75a68fin this environment.AI assistance: Codex helped investigate the report sequence, implement the change, and run validation. Kerim Sabic confirmed an in-depth review of the prepared patch and explanation before submission and is the human contributor responsible for the change.
changelog/14575.bugfix.rst.AUTHORSin alphabetical order.No feature documentation is needed for this bugfix. AI assistance is disclosed above; optional AI coauthor trailers have not been added.