Merge pull request #10137 from pytest-dev/backport-10133-to-7.1.x
This commit is contained in:
commit
0b65f0bb6f
1
AUTHORS
1
AUTHORS
|
@ -247,6 +247,7 @@ Nicholas Murphy
|
||||||
Niclas Olofsson
|
Niclas Olofsson
|
||||||
Nicolas Delaby
|
Nicolas Delaby
|
||||||
Nikolay Kondratyev
|
Nikolay Kondratyev
|
||||||
|
Nipunn Koorapati
|
||||||
Olga Matoula
|
Olga Matoula
|
||||||
Oleg Pidsadnyi
|
Oleg Pidsadnyi
|
||||||
Oleg Sushchenko
|
Oleg Sushchenko
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Type-annotate ``FixtureRequest.param`` as ``Any`` as a stop gap measure until :issue:`8073` is fixed.
|
|
@ -350,7 +350,7 @@ def reorder_items_atscope(
|
||||||
return items_done
|
return items_done
|
||||||
|
|
||||||
|
|
||||||
def get_direct_param_fixture_func(request):
|
def get_direct_param_fixture_func(request: "FixtureRequest") -> Any:
|
||||||
return request.param
|
return request.param
|
||||||
|
|
||||||
|
|
||||||
|
@ -412,6 +412,15 @@ class FixtureRequest:
|
||||||
self._arg2fixturedefs = fixtureinfo.name2fixturedefs.copy()
|
self._arg2fixturedefs = fixtureinfo.name2fixturedefs.copy()
|
||||||
self._arg2index: Dict[str, int] = {}
|
self._arg2index: Dict[str, int] = {}
|
||||||
self._fixturemanager: FixtureManager = pyfuncitem.session._fixturemanager
|
self._fixturemanager: FixtureManager = pyfuncitem.session._fixturemanager
|
||||||
|
# Notes on the type of `param`:
|
||||||
|
# -`request.param` is only defined in parametrized fixtures, and will raise
|
||||||
|
# AttributeError otherwise. Python typing has no notion of "undefined", so
|
||||||
|
# this cannot be reflected in the type.
|
||||||
|
# - Technically `param` is only (possibly) defined on SubRequest, not
|
||||||
|
# FixtureRequest, but the typing of that is still in flux so this cheats.
|
||||||
|
# - In the future we might consider using a generic for the param type, but
|
||||||
|
# for now just using Any.
|
||||||
|
self.param: Any
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def scope(self) -> "_ScopeName":
|
def scope(self) -> "_ScopeName":
|
||||||
|
|
Loading…
Reference in New Issue