@@ -505,26 +505,14 @@ def _genfunctions(self, name: str, funcobj) -> Iterator["Function"]:
505505
506506 for callspec in metafunc ._calls :
507507 subname = f"{ name } [{ callspec .id } ]"
508- node = Function .from_parent (
508+ yield Function .from_parent (
509509 self ,
510510 name = subname ,
511511 callspec = callspec ,
512512 fixtureinfo = fixtureinfo ,
513513 keywords = {callspec .id : True },
514514 originalname = name ,
515515 )
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
528516
529517
530518def importtestmodule (
@@ -1809,10 +1797,14 @@ def __init__(
18091797 if keywords :
18101798 self .keywords .update (keywords )
18111799
1800+ fixtureinfo_ = self .session ._fixturemanager .getfixtureinfo (
1801+ self , self .obj , self .cls , funcargs = True
1802+ )
18121803 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_
18161808 self ._fixtureinfo : FuncFixtureInfo = fixtureinfo
18171809 self .fixturenames = fixtureinfo .names_closure
18181810 self ._initrequest ()
0 commit comments