Skip to content

[PR #15374/fc9a7ef6 backport][9.2.x] Store raw parametrize ids on a shared mark, not resolved ones - #15375

Merged
RonnyPfannschmidt merged 1 commit into
9.2.xfrom
patchback/backports/9.2.x/fc9a7ef678f64d17f1c03b619f3842ea1d127e74/pr-15374
Nov 11, 2026
Merged

RonnyPfannschmidt merged 1 commit into
9.2.xfrom
patchback/backports/9.2.x/fc9a7ef678f64d17f1c03b619f3842ea1d127e74/pr-15374

Conversation

@patchback

@patchback patchback Bot commented Nov 11, 2026

Copy link
Copy Markdown

This is a backport of PR #15374 as merged into main (fc9a7ef).

Requested by Ronny · project thread

🤖 Written by Claude Opus 5.5 via Claude Code for the pytest maintainers; I prompted it, it did the work, I read it.

Closes #15370.

The ids cache on the source parametrize mark (Mark._param_ids_generated) exists so an ids iterator (#759) is consumed only once by all tests sharing the mark. It stored the output of _resolve_parameter_set_ids (escaped, made unique) and fed it back as input ids=, so every further test sharing the mark escaped the ids again. The mark lives on the imported module, so this also carried over between pytest.main() calls in one process.

The fix stores the validated raw ids instead and resolves them on every call. Unlike skipping the second resolution, this also stops later sessions from reusing ids resolved under another session's config (for example the id-escaping ini option, or a different pytest_make_parametrize_id).

Test: one unit test that runs a shared mark with an iterator id needing escaping through two Metafuncs. It fails on main and passes with the fix. testing/python, testing/test_mark.py, testing/test_collection.py, testing/test_nodes.py show no new failures.

  • Include new tests or update existing tests when applicable.
  • Allow maintainers to push and squash when merging my commits.
  • Add text like closes #XYZW to the PR description and/or commits.
  • If AI agents were used, they are credited in Co-authored-by commit trailers.
  • Create a new changelog file in the changelog directory.

Generated by Claude Code

Store raw parametrize ids on a shared mark, not resolved ones

(cherry picked from commit fc9a7ef)
@RonnyPfannschmidt
RonnyPfannschmidt merged commit c5a4d14 into 9.2.x Nov 11, 2026
36 checks passed
@RonnyPfannschmidt
RonnyPfannschmidt deleted the patchback/backports/9.2.x/fc9a7ef678f64d17f1c03b619f3842ea1d127e74/pr-15374 branch November 11, 2026 12:20
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