@@ -504,26 +504,14 @@ def _genfunctions(self, name: str, funcobj) -> Iterator["Function"]:
504504
505505 for callspec in metafunc ._calls :
506506 subname = f"{ name } [{ callspec .id } ]"
507- node = Function .from_parent (
507+ yield Function .from_parent (
508508 self ,
509509 name = subname ,
510510 callspec = callspec ,
511511 fixtureinfo = fixtureinfo ,
512512 keywords = {callspec .id : True },
513513 originalname = name ,
514514 )
515- # if usefixtures is added via a parameter, then there will be
516- # fixtures missing from the node.fixturenames
517- callspec_usefixtures = tuple (
518- arg
519- for mark in node .iter_markers (name = "usefixtures" )
520- for arg in mark .args
521- if arg not in node .fixturenames
522- )
523- if callspec_usefixtures :
524- # node.fixturenames must be unique for this parameter
525- node .fixturenames = [* node .fixturenames , * callspec_usefixtures ]
526- yield node
527515
528516
529517def importtestmodule (
@@ -1759,10 +1747,14 @@ def __init__(
17591747 if keywords :
17601748 self .keywords .update (keywords )
17611749
1750+ fixtureinfo_ = self .session ._fixturemanager .getfixtureinfo (
1751+ self , self .obj , self .cls , funcargs = True
1752+ )
17621753 if fixtureinfo is None :
1763- fixtureinfo = self .session ._fixturemanager .getfixtureinfo (
1764- self , self .obj , self .cls , funcargs = True
1765- )
1754+ fixtureinfo = fixtureinfo_
1755+ elif set (fixtureinfo_ .names_closure ) != set (fixtureinfo .names_closure ):
1756+ fixtureinfo_ .name2fixturedefs .update (fixtureinfo .name2fixturedefs )
1757+ fixtureinfo = fixtureinfo_
17661758 self ._fixtureinfo : FuncFixtureInfo = fixtureinfo
17671759 self .fixturenames = fixtureinfo .names_closure
17681760 self ._initrequest ()
0 commit comments