Skip to content

Conversation

bluetech
Copy link
Member

@bluetech bluetech commented Oct 6, 2025

Continuation of #13774.

The previous fix was a minimal change to make the existing code at least consider fixtures overrides, and handles the common case (direct override chains), but still wasn't correct, as it didn't handle override chains involving an intermediary (not the overridden) fixture.

To make this work, the algorithm needs to change. Now instead of a simple breadth-first search, we do a depth-first search, which more closely simulates the runtime behavior, and allows us the to check the "stack" of fixtures so we can use the correct fixture index (depth in the override chain).

This is more expensive but should be OK.

Refs #13773.

Explicitly test a couple more scenarios. One of the tests doesn't
currently pass so marked xfail.
Continuation of 72ae3db.

The previous fix was a minimal change to make the existing code at least
consider fixtures overrides, and handles the common case (direct
override chains), but still wasn't correct, as it didn't handle
override chains involving an intermediary (not the overridden) fixture.

To make this work, the algorithm needs to change. Now instead of a
simple breadth-first search, we do a depth-first search, which more
closely simulates the runtime behavior, and allows us the to check the
"stack" of fixtures so we can use the correct fixture index (depth in
the override chain).

This is more expensive but should be OK.

Refs pytest-dev#13773.
@bluetech bluetech force-pushed the fixtures-closure-visibility-3 branch from 9ef765f to 3f831e6 Compare October 6, 2025 10:06
@bluetech bluetech added the skip news used on prs to opt out of the changelog requirement label Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news used on prs to opt out of the changelog requirement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant