Open
Description
I could presumably submit a PR for this if it making SubRequest
a Generic
is deemed a good approach.
What's the problem this feature will solve?
When type hinting a parameter for a request
fixture the request.param
attribute is typed as Any
and I have to # type: ignore[no-any-return]
.
Describe the solution you'd like
Long term, a plugin would be nice to automatically relate the .param
to it's source in the @pytest.fixture()
decoration. Short term, Request
could just be a Generic
.
This would allow me to use request: _pytest.fixtures.SubRequest[MyType]
instead of the type ignore and get any useful hints on the .param
attribute inside the fixture as well as return type verification.
Alternative Solutions
I have not tried anything beyond the type ignore.
Additional context
None.