Open
Description
What's the problem this feature will solve?
Add typing information for parameterized fixtures to have better support for type checkers.
Describe the solution you'd like
Given a fixture like
@pytest.fixture(params=["--setup-only", "--setup-plan", "--setup-show"])
def mode(request):
return request.param
what is the type of request
? I thought it would be FixtureRequest
but this class doesn't have a param
object. Thus I suggest to add a generic class ParametrizedFixtureRequest[T]
where T
is the type of the parameter. Thus in the above example one could annotate request: ParametrizedFixtureRequest[str]
and then the type checker would know that request.param
is a string.