diff --git a/src/_pytest/fixtures.py b/src/_pytest/fixtures.py index 4975be820..d1d36d7fa 100644 --- a/src/_pytest/fixtures.py +++ b/src/_pytest/fixtures.py @@ -407,6 +407,14 @@ class FixtureRequest: self._arg2fixturedefs = fixtureinfo.name2fixturedefs.copy() self._arg2index: Dict[str, int] = {} 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