@@ -267,7 +267,6 @@ def __init__(self, pyfuncitem):
267
267
self .fixturename = None
268
268
#: Scope string, one of "function", "class", "module", "session"
269
269
self .scope = "function"
270
- self ._fixture_values = {} # argname -> fixture value
271
270
self ._fixture_defs = {} # argname -> FixtureDef
272
271
fixtureinfo = pyfuncitem ._fixtureinfo
273
272
self ._arg2fixturedefs = fixtureinfo .name2fixturedefs .copy ()
@@ -450,8 +449,7 @@ class PseudoFixtureDef:
450
449
raise
451
450
# remove indent to prevent the python3 exception
452
451
# from leaking into the call
453
- result = self ._getfixturevalue (fixturedef )
454
- self ._fixture_values [argname ] = result
452
+ self ._compute_fixture_value (fixturedef )
455
453
self ._fixture_defs [argname ] = fixturedef
456
454
return fixturedef
457
455
@@ -466,7 +464,14 @@ def _get_fixturestack(self):
466
464
values .append (fixturedef )
467
465
current = current ._parent_request
468
466
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
+ """
470
475
# prepare a subrequest object before calling fixture function
471
476
# (latter managed by fixturedef)
472
477
argname = fixturedef .argname
@@ -515,12 +520,11 @@ def _getfixturevalue(self, fixturedef):
515
520
exc_clear ()
516
521
try :
517
522
# call the fixture function
518
- val = fixturedef .execute (request = subrequest )
523
+ fixturedef .execute (request = subrequest )
519
524
finally :
520
525
# if fixture function failed it might have registered finalizers
521
526
self .session ._setupstate .addfinalizer (functools .partial (fixturedef .finish , request = subrequest ),
522
527
subrequest .node )
523
- return val
524
528
525
529
def _check_scope (self , argname , invoking_scope , requested_scope ):
526
530
if argname == "request" :
@@ -573,7 +577,6 @@ def __init__(self, request, scope, param, param_index, fixturedef):
573
577
self .scope = scope
574
578
self ._fixturedef = fixturedef
575
579
self ._pyfuncitem = request ._pyfuncitem
576
- self ._fixture_values = request ._fixture_values
577
580
self ._fixture_defs = request ._fixture_defs
578
581
self ._arg2fixturedefs = request ._arg2fixturedefs
579
582
self ._arg2index = request ._arg2index
0 commit comments