@@ -267,7 +267,6 @@ def __init__(self, pyfuncitem):
267267 self .fixturename = None
268268 #: Scope string, one of "function", "class", "module", "session"
269269 self .scope = "function"
270- self ._fixture_values = {} # argname -> fixture value
271270 self ._fixture_defs = {} # argname -> FixtureDef
272271 fixtureinfo = pyfuncitem ._fixtureinfo
273272 self ._arg2fixturedefs = fixtureinfo .name2fixturedefs .copy ()
@@ -450,8 +449,7 @@ class PseudoFixtureDef:
450449 raise
451450 # remove indent to prevent the python3 exception
452451 # from leaking into the call
453- result = self ._getfixturevalue (fixturedef )
454- self ._fixture_values [argname ] = result
452+ self ._compute_fixture_value (fixturedef )
455453 self ._fixture_defs [argname ] = fixturedef
456454 return fixturedef
457455
@@ -466,7 +464,14 @@ def _get_fixturestack(self):
466464 values .append (fixturedef )
467465 current = current ._parent_request
468466
469- def _getfixturevalue (self , fixturedef ):
467+ def _compute_fixture_value (self , fixturedef ):
468+ """
469+ Creates a SubRequest based on "self" and calls the execute method of the given fixturedef object. This will
470+ force the FixtureDef object to throw away any previous results and compute a new fixture value, which
471+ will be stored into the FixtureDef object itself.
472+
473+ :param FixtureDef fixturedef:
474+ """
470475 # prepare a subrequest object before calling fixture function
471476 # (latter managed by fixturedef)
472477 argname = fixturedef .argname
@@ -515,12 +520,11 @@ def _getfixturevalue(self, fixturedef):
515520 exc_clear ()
516521 try :
517522 # call the fixture function
518- val = fixturedef .execute (request = subrequest )
523+ fixturedef .execute (request = subrequest )
519524 finally :
520525 # if fixture function failed it might have registered finalizers
521526 self .session ._setupstate .addfinalizer (functools .partial (fixturedef .finish , request = subrequest ),
522527 subrequest .node )
523- return val
524528
525529 def _check_scope (self , argname , invoking_scope , requested_scope ):
526530 if argname == "request" :
@@ -573,7 +577,6 @@ def __init__(self, request, scope, param, param_index, fixturedef):
573577 self .scope = scope
574578 self ._fixturedef = fixturedef
575579 self ._pyfuncitem = request ._pyfuncitem
576- self ._fixture_values = request ._fixture_values
577580 self ._fixture_defs = request ._fixture_defs
578581 self ._arg2fixturedefs = request ._arg2fixturedefs
579582 self ._arg2index = request ._arg2index
0 commit comments