diff --git a/_pytest/fixtures.py b/_pytest/fixtures.py index a8445767c..21fc32846 100644 --- a/_pytest/fixtures.py +++ b/_pytest/fixtures.py @@ -4,7 +4,7 @@ import functools import inspect import sys import warnings -from collections import OrderedDict, deque, defaultdict +from collections import OrderedDict, deque, defaultdict, namedtuple import attr import py @@ -23,6 +23,8 @@ from _pytest.compat import ( ) from _pytest.outcomes import fail, TEST_OUTCOME +PseudoFixtureDef = namedtuple('PseudoFixtureDef', ('cached_result', 'scope')) + def pytest_sessionstart(session): import _pytest.python @@ -440,10 +442,9 @@ class FixtureRequest(FuncargnamesCompatAttr): fixturedef = self._getnextfixturedef(argname) except FixtureLookupError: if argname == "request": - class PseudoFixtureDef(object): - cached_result = (self, [0], None) - scope = "function" - return PseudoFixtureDef + cached_result = (self, [0], None) + scope = "function" + return PseudoFixtureDef(cached_result, scope) raise # remove indent to prevent the python3 exception # from leaking into the call