GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Respect parametrization scope in fixture cache reuse by Ace-0-A · Pull Request #15112 · pytest-dev/pytest ConversationCloses #11575. I traced the bug to fixture cache reuse. Pytest compared only the parameter value, so a module-scoped result could be returned to a later function-scoped request when both parametrizations used the same value. The fix records the effective parametrization scope with the cached result and checks it before reuse. The new test covers a module-scoped parametrization followed by a function-scoped one using the same value. I ran the full test suite and pre-commit checks. All passed. I used Codex as a development tool and reviewed the final change.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
RonnyPfannschmidt
requested changes
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤖 Written by Claude Opus 5.5 via Claude Code for the pytest maintainers; I prompted it, it did the work, I read it. Thanks, the cache change is correct and should stay: as long as a narrower param scope is allowed, tearing down and recreating is the only way not to hand out the wrong value. But it makes this case visibly more expensive. If tests are reordered (or simply interleaved), a module-scoped fixture is now set up several times within one module: @pytest.fixture(scope="module") def fx(request): ... @pytest.mark.parametrize("fx", ["a"], scope="module", indirect=True) def test1(fx): ... @pytest.mark.parametrize("fx", ["a"], scope="function", indirect=True) def test2(fx): ... @pytest.mark.parametrize("fx", ["a"], scope="module", indirect=True) def test3(fx): ... In the order test1, test2, test3, the module-scoped We want to phase out narrower param scopes (see #11575 (comment)). Could you add to this PR:
Generated by Claude Code
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
5 tasks done
This branch has not been deployedNo deployments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersRequested changes must be addressed to merge this pull request. Uh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
bot:chronographer:provided
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Indirect parametrization with scope="function" does not always workUh oh!
There was an error while loading. Please reload this page. 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. |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |