Skip to content

Fix subtest reruns with structured NodeId keys - #363

Open
janmrow wants to merge 2 commits into
pytest-dev:masterfrom
janmrow:fix-subtest-nodeid-compatibility
Open

Fix subtest reruns with structured NodeId keys#363
janmrow wants to merge 2 commits into
pytest-dev:masterfrom
janmrow:fix-subtest-nodeid-compatibility

Conversation

@janmrow

@janmrow janmrow commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

pytest-dev/pytest#14758 changed how pytest stores node IDs internally: instead of strings, it now uses NodeId objects.

Because of this, the private failed_subtests mapping uses NodeId objects as keys.

pytest-rerunfailures was still looking up failed subtests using string .nodeid values. So that failed subtests were not rerun with newer pytest versions.

This change uses .id when NodeId is available, and falls back to .nodeid for older pytest versions.

Tested locally:

  • the full test suite passes with pytest 9.1.1 and pytest main at 431f3e1f5,
  • subtest regression tests pass,
  • related xdist/subtest tests pass.

Only the failed_subtests handling was changed. Other uses of .nodeid stay the same.

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.

1 participant