@@ -505,26 +505,14 @@ def _genfunctions(self, name: str, funcobj) -> Iterator["Function"]:
505
505
506
506
for callspec in metafunc ._calls :
507
507
subname = f"{ name } [{ callspec .id } ]"
508
- node = Function .from_parent (
508
+ yield Function .from_parent (
509
509
self ,
510
510
name = subname ,
511
511
callspec = callspec ,
512
512
fixtureinfo = fixtureinfo ,
513
513
keywords = {callspec .id : True },
514
514
originalname = name ,
515
515
)
516
- # if usefixtures is added via a parameter, then there will be
517
- # fixtures missing from the node.fixturenames
518
- callspec_usefixtures = tuple (
519
- arg
520
- for mark in node .iter_markers (name = "usefixtures" )
521
- for arg in mark .args
522
- if arg not in node .fixturenames
523
- )
524
- if callspec_usefixtures :
525
- # node.fixturenames must be unique for this parameter
526
- node .fixturenames = [* node .fixturenames , * callspec_usefixtures ]
527
- yield node
528
516
529
517
530
518
def importtestmodule (
@@ -1809,10 +1797,14 @@ def __init__(
1809
1797
if keywords :
1810
1798
self .keywords .update (keywords )
1811
1799
1800
+ fixtureinfo_ = self .session ._fixturemanager .getfixtureinfo (
1801
+ self , self .obj , self .cls , funcargs = True
1802
+ )
1812
1803
if fixtureinfo is None :
1813
- fixtureinfo = self .session ._fixturemanager .getfixtureinfo (
1814
- self , self .obj , self .cls , funcargs = True
1815
- )
1804
+ fixtureinfo = fixtureinfo_
1805
+ elif set (fixtureinfo_ .names_closure ) != set (fixtureinfo .names_closure ):
1806
+ fixtureinfo_ .name2fixturedefs .update (fixtureinfo .name2fixturedefs )
1807
+ fixtureinfo = fixtureinfo_
1816
1808
self ._fixtureinfo : FuncFixtureInfo = fixtureinfo
1817
1809
self .fixturenames = fixtureinfo .names_closure
1818
1810
self ._initrequest ()
0 commit comments