Skip to content

[ty] Avoid unnecessary Salsa queries during pytest fixture lookup - #28071

Merged
lerebear merged 3 commits into
mainfrom
lerebear/push-xvsnymowqvzk
Aug 26, 2026
Merged

[ty] Avoid unnecessary Salsa queries during pytest fixture lookup#28071
lerebear merged 3 commits into
mainfrom
lerebear/push-xvsnymowqvzk

Conversation

@lerebear

@lerebear lerebear commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

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:

  • Return from fixture_declaration before calling function_known_decorators when a function has no decorators.
  • Return from fixture_candidates_from_definition before calling exists_at_runtime when the definition kind cannot expose a fixture.
  • Return from directly_parametrized before calling function_known_decorators when 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.

@lerebear lerebear added the internal An internal refactor or improvement label Aug 26, 2026
@astral-sh-bot astral-sh-bot Bot added the ty Multi-file analysis & type inference label Aug 26, 2026
@lerebear
lerebear force-pushed the lerebear/push-xvsnymowqvzk branch from 0542adf to 2b24a43 Compare August 26, 2026 15:24
@lerebear
lerebear force-pushed the lerebear/push-xvsnymowqvzk branch from 2b24a43 to 1e35d23 Compare August 26, 2026 15:29
@lerebear
lerebear marked this pull request as ready for review August 26, 2026 18:13
@lerebear
lerebear requested a review from a team as a code owner August 26, 2026 18:13
@astral-sh-bot
astral-sh-bot Bot requested a review from carljm August 26, 2026 18:13
@lerebear
lerebear merged commit 0eeb97d into main Aug 26, 2026
77 of 89 checks passed
@lerebear
lerebear deleted the lerebear/push-xvsnymowqvzk branch August 26, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal An internal refactor or improvement ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant