@@ -210,16 +210,14 @@ def reorder_items(items: Sequence[nodes.Item]) -> List[nodes.Item]:
210
210
argkeys_cache : Dict [Scope , Dict [nodes .Item , Dict [FixtureArgKey , None ]]] = {}
211
211
items_by_argkey : Dict [Scope , Dict [FixtureArgKey , Deque [nodes .Item ]]] = {}
212
212
for scope in HIGH_SCOPES :
213
- d : Dict [nodes .Item , Dict [FixtureArgKey , None ]] = {}
214
- argkeys_cache [scope ] = d
215
- item_d : Dict [FixtureArgKey , Deque [nodes .Item ]] = defaultdict (deque )
216
- items_by_argkey [scope ] = item_d
213
+ scoped_argkeys_cache = argkeys_cache [scope ] = {}
214
+ scoped_items_by_argkey = items_by_argkey [scope ] = defaultdict (deque )
217
215
for item in items :
218
216
keys = dict .fromkeys (get_parametrized_fixture_keys (item , scope ), None )
219
217
if keys :
220
- d [item ] = keys
218
+ scoped_argkeys_cache [item ] = keys
221
219
for key in keys :
222
- item_d [key ].append (item )
220
+ scoped_items_by_argkey [key ].append (item )
223
221
items_dict = dict .fromkeys (items , None )
224
222
return list (
225
223
reorder_items_atscope (items_dict , argkeys_cache , items_by_argkey , Scope .Session )
@@ -407,7 +405,7 @@ def scope(self) -> _ScopeName:
407
405
@property
408
406
def fixturenames (self ) -> List [str ]:
409
407
"""Names of all active fixtures in this request."""
410
- result = list (self ._pyfuncitem ._fixtureinfo . names_closure )
408
+ result = list (self ._pyfuncitem .fixturenames )
411
409
result .extend (set (self ._fixture_defs ).difference (result ))
412
410
return result
413
411
@@ -687,8 +685,7 @@ def __repr__(self) -> str:
687
685
688
686
def _fillfixtures (self ) -> None :
689
687
item = self ._pyfuncitem
690
- fixturenames = getattr (item , "fixturenames" , self .fixturenames )
691
- for argname in fixturenames :
688
+ for argname in item .fixturenames :
692
689
if argname not in item .funcargs :
693
690
item .funcargs [argname ] = self .getfixturevalue (argname )
694
691
@@ -794,7 +791,10 @@ def _schedule_finalizers(
794
791
# If the executing fixturedef was not explicitly requested in the argument list (via
795
792
# getfixturevalue inside the fixture call) then ensure this fixture def will be finished
796
793
# first.
797
- if fixturedef .argname not in self .fixturenames :
794
+ if (
795
+ fixturedef .argname not in self ._fixture_defs
796
+ and fixturedef .argname not in self ._pyfuncitem .fixturenames
797
+ ):
798
798
fixturedef .addfinalizer (
799
799
functools .partial (self ._fixturedef .finish , request = self )
800
800
)
0 commit comments