Fix --last-failed for custom item names containing brackets - #15065
Open
SIBTAIN-ASAD wants to merge 7 commits into
Open
SIBTAIN-ASAD wants to merge 7 commits into
SIBTAIN-ASAD wants to merge 7 commits into
Conversation
Contributor
|
Dup of #15046? |
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.
Fixes #15045.
Custom collectors can create item names that contain brackets, such as
a_bad[one]. The--last-failedcache stores the string nodeid, but reparsing that string treats the bracketed portion as parameters. The structured id then no longer compares equal to the live custom item, so a later--lfrun can skip the still-failing item and report success.This keeps the cache keys in their original string form and compares collected/report ids using their canonical string representation. Paths still use
NodeId.parse()only when deriving the files that contain previous failures.Verification:
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --frozen pytest --override-ini=minversion=0 testing/test_cacheprovider.py -q— 69 passedPYTEST_DISABLE_PLUGIN_AUTOLOAD=1 uv run --frozen pytest --override-ini=minversion=0 testing/test_cacheprovider.py testing/python/fixtures.py testing/python/show_fixtures_per_test.py -q— 327 passed, 3 xfaileduvx --from ruff ruff check src/_pytest/cacheprovider.py testing/test_cacheprovider.pyuvx --from ruff ruff format --check src/_pytest/cacheprovider.py testing/test_cacheprovider.pygit diff --check