Skip to content

Conversation

bluetech
Copy link
Member

@bluetech bluetech commented Oct 8, 2025

The first commit is a prerequisite typing fix.

The second commit is as the title says. Removes some special cases from the code, and makes the types more regular. Also avoids confusion with a different concept of "pseudo fixturedef" in python.py, which used to really confuse me.

This TypeVar represents the return value of the fixture function, so
should be covariant.
…real FixtureDef

Remove some special cases from the code, and make the types more
regular.
requested_fixturedef: FixtureDef[object],
requested_scope: Scope,
) -> None:
if isinstance(requested_fixturedef, PseudoFixtureDef):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed, request always has Function scope so will never fail this check.

# down first. This is generally handled by SetupState, but still currently
# needed when this fixture is not parametrized but depends on a parametrized
# fixture.
if not isinstance(fixturedef, PseudoFixtureDef):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To remove this special case, I made RequestFixtureDef just ignore addfinalizer calls.

@bluetech bluetech added the skip news used on prs to opt out of the changelog requirement label Oct 8, 2025
@bluetech bluetech merged commit db89537 into pytest-dev:main Oct 9, 2025
33 checks passed
@bluetech bluetech deleted the rm-pseudo-fixturedef-2 branch October 9, 2025 15:28
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.

2 participants