[ty] Avoid unnecessary Salsa queries during pytest fixture lookup - #28071
Merged
Conversation
lerebear
force-pushed
the
lerebear/push-xvsnymowqvzk
branch
from
August 26, 2026 15:24
0542adf to
2b24a43
Compare
lerebear
force-pushed
the
lerebear/push-xvsnymowqvzk
branch
from
August 26, 2026 15:29
2b24a43 to
1e35d23
Compare
lerebear
marked this pull request as ready for review
August 26, 2026 18:13
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.
Summary
In anticipation of "find references" for pytest fixtures, which introduces many more speculative attempts at resolving pytest fixtures, this PR helps preserve efficiency by short-circuiting a few Salsa queries:
fixture_declarationbefore callingfunction_known_decoratorswhen a function has no decorators.fixture_candidates_from_definitionbefore callingexists_at_runtimewhen the definition kind cannot expose a fixture.directly_parametrizedbefore callingfunction_known_decoratorswhen the test function has no decorators (while still checking parametrization from an enclosing class).These are all behavior-preserving early exits.
Test Plan
This is a refactor that relies on existing test coverage.