@@ -507,26 +507,14 @@ def _genfunctions(self, name: str, funcobj) -> Iterator["Function"]:
507507
508508 for callspec in metafunc ._calls :
509509 subname = f"{ name } [{ callspec .id } ]"
510- node = Function .from_parent (
510+ yield Function .from_parent (
511511 self ,
512512 name = subname ,
513513 callspec = callspec ,
514514 fixtureinfo = fixtureinfo ,
515515 keywords = {callspec .id : True },
516516 originalname = name ,
517517 )
518- # if usefixtures is added via a parameter, then there will be
519- # fixtures missing from the node.fixturenames
520- callspec_usefixtures = tuple (
521- arg
522- for mark in node .iter_markers (name = "usefixtures" )
523- for arg in mark .args
524- if arg not in node .fixturenames
525- )
526- if callspec_usefixtures :
527- # node.fixturenames must be unique for this parameter
528- node .fixturenames = [* node .fixturenames , * callspec_usefixtures ]
529- yield node
530518
531519
532520def importtestmodule (
@@ -1811,9 +1799,13 @@ def __init__(
18111799 if keywords :
18121800 self .keywords .update (keywords )
18131801
1802+ fm = self .session ._fixturemanager
1803+ fixtureinfo_ = fm .getfixtureinfo (self , self .obj , self .cls )
18141804 if fixtureinfo is None :
1815- fm = self .session ._fixturemanager
1816- fixtureinfo = fm .getfixtureinfo (self , self .obj , self .cls )
1805+ fixtureinfo = fixtureinfo_
1806+ elif set (fixtureinfo_ .names_closure ) != set (fixtureinfo .names_closure ):
1807+ fixtureinfo_ .name2fixturedefs .update (fixtureinfo .name2fixturedefs )
1808+ fixtureinfo = fixtureinfo_
18171809 self ._fixtureinfo : FuncFixtureInfo = fixtureinfo
18181810 self .fixturenames = fixtureinfo .names_closure
18191811 self ._initrequest ()
0 commit comments