@@ -131,7 +131,7 @@ def pytest_sessionstart(session: Session) -> None:
131131
132132def get_scope_package (
133133 node : nodes .Item ,
134- fixturedef : FixtureDef [Any , object ],
134+ fixturedef : FixtureDef [object ],
135135) -> nodes .Node | None :
136136 from _pytest .python import Package
137137
@@ -328,7 +328,7 @@ class FuncFixtureInfo:
328328 # matching the name which are applicable to this function.
329329 # There may be multiple overriding fixtures with the same name. The
330330 # sequence is ordered from furthest to closes to the function.
331- name2fixturedefs : dict [str , Sequence [FixtureDef [Any , Any ]]]
331+ name2fixturedefs : dict [str , Sequence [FixtureDef [Any ]]]
332332
333333 def prune_dependency_tree (self ) -> None :
334334 """Recompute names_closure from initialnames and name2fixturedefs.
@@ -369,8 +369,8 @@ def __init__(
369369 self ,
370370 pyfuncitem : Function ,
371371 fixturename : str | None ,
372- arg2fixturedefs : dict [str , Sequence [FixtureDef [Any , Any ]]],
373- fixture_defs : dict [str , FixtureDef [Any , Any ]],
372+ arg2fixturedefs : dict [str , Sequence [FixtureDef [Any ]]],
373+ fixture_defs : dict [str , FixtureDef [Any ]],
374374 * ,
375375 _ispytest : bool = False ,
376376 ) -> None :
@@ -413,7 +413,7 @@ def scope(self) -> _ScopeName:
413413 @abc .abstractmethod
414414 def _check_scope (
415415 self ,
416- requested_fixturedef : FixtureDef [Any , object ] | PseudoFixtureDef [object ],
416+ requested_fixturedef : FixtureDef [object ] | PseudoFixtureDef [object ],
417417 requested_scope : Scope ,
418418 ) -> None :
419419 raise NotImplementedError ()
@@ -554,7 +554,7 @@ def _iter_chain(self) -> Iterator[SubRequest]:
554554
555555 def _get_active_fixturedef (
556556 self , argname : str
557- ) -> FixtureDef [Any , object ] | PseudoFixtureDef [object ]:
557+ ) -> FixtureDef [object ] | PseudoFixtureDef [object ]:
558558 if argname == "request" :
559559 cached_result = (self , [0 ], None )
560560 return PseudoFixtureDef (cached_result , Scope .Function )
@@ -626,9 +626,7 @@ def _get_active_fixturedef(
626626 self ._fixture_defs [argname ] = fixturedef
627627 return fixturedef
628628
629- def _check_fixturedef_without_param (
630- self , fixturedef : FixtureDef [Any , object ]
631- ) -> None :
629+ def _check_fixturedef_without_param (self , fixturedef : FixtureDef [object ]) -> None :
632630 """Check that this request is allowed to execute this fixturedef without
633631 a param."""
634632 funcitem = self ._pyfuncitem
@@ -661,7 +659,7 @@ def _check_fixturedef_without_param(
661659 )
662660 fail (msg , pytrace = False )
663661
664- def _get_fixturestack (self ) -> list [FixtureDef [Any , Any ]]:
662+ def _get_fixturestack (self ) -> list [FixtureDef [Any ]]:
665663 values = [request ._fixturedef for request in self ._iter_chain ()]
666664 values .reverse ()
667665 return values
@@ -686,7 +684,7 @@ def _scope(self) -> Scope:
686684
687685 def _check_scope (
688686 self ,
689- requested_fixturedef : FixtureDef [Any , object ] | PseudoFixtureDef [object ],
687+ requested_fixturedef : FixtureDef [object ] | PseudoFixtureDef [object ],
690688 requested_scope : Scope ,
691689 ) -> None :
692690 # TopRequest always has function scope so always valid.
@@ -720,7 +718,7 @@ def __init__(
720718 scope : Scope ,
721719 param : Any ,
722720 param_index : int ,
723- fixturedef : FixtureDef [Any , object ],
721+ fixturedef : FixtureDef [object ],
724722 * ,
725723 _ispytest : bool = False ,
726724 ) -> None :
@@ -733,7 +731,7 @@ def __init__(
733731 )
734732 self ._parent_request : Final [FixtureRequest ] = request
735733 self ._scope_field : Final = scope
736- self ._fixturedef : Final [FixtureDef [Any , object ]] = fixturedef
734+ self ._fixturedef : Final [FixtureDef [object ]] = fixturedef
737735 if param is not NOTSET :
738736 self .param = param
739737 self .param_index : Final = param_index
@@ -763,7 +761,7 @@ def node(self):
763761
764762 def _check_scope (
765763 self ,
766- requested_fixturedef : FixtureDef [Any , object ] | PseudoFixtureDef [object ],
764+ requested_fixturedef : FixtureDef [object ] | PseudoFixtureDef [object ],
767765 requested_scope : Scope ,
768766 ) -> None :
769767 if isinstance (requested_fixturedef , PseudoFixtureDef ):
@@ -784,7 +782,7 @@ def _check_scope(
784782 pytrace = False ,
785783 )
786784
787- def _format_fixturedef_line (self , fixturedef : FixtureDef [Any , object ]) -> str :
785+ def _format_fixturedef_line (self , fixturedef : FixtureDef [object ]) -> str :
788786 factory = fixturedef .func
789787 path , lineno = getfslineno (factory )
790788 if isinstance (path , Path ):
@@ -959,7 +957,7 @@ def _eval_scope_callable(
959957
960958
961959@final
962- class FixtureDef (Generic [FixtureParams , FixtureValue ]):
960+ class FixtureDef (Generic [FixtureValue ]):
963961 """A container for a fixture definition.
964962
965963 This is a generic class parametrized on the parameters that a fixture function receives and its return value.
@@ -973,7 +971,7 @@ def __init__(
973971 config : Config ,
974972 baseid : str | None ,
975973 argname : str ,
976- func : _FixtureFunc [FixtureParams , FixtureValue ],
974+ func : _FixtureFunc [Any , FixtureValue ],
977975 scope : Scope | _ScopeName | Callable [[str , Config ], _ScopeName ] | None ,
978976 params : Sequence [object ] | None ,
979977 ids : tuple [object | None , ...] | Callable [[Any ], object | None ] | None = None ,
@@ -1128,8 +1126,8 @@ def __repr__(self) -> str:
11281126
11291127
11301128def resolve_fixture_function (
1131- fixturedef : FixtureDef [FixtureParams , FixtureValue ], request : FixtureRequest
1132- ) -> _FixtureFunc [FixtureParams , FixtureValue ]:
1129+ fixturedef : FixtureDef [FixtureValue ], request : FixtureRequest
1130+ ) -> _FixtureFunc [Any , FixtureValue ]:
11331131 """Get the actual callable that can be called to obtain the fixture
11341132 value."""
11351133 fixturefunc = fixturedef .func
@@ -1152,7 +1150,7 @@ def resolve_fixture_function(
11521150
11531151
11541152def pytest_fixture_setup (
1155- fixturedef : FixtureDef [FixtureParams , FixtureValue ], request : SubRequest
1153+ fixturedef : FixtureDef [FixtureValue ], request : SubRequest
11561154) -> FixtureValue :
11571155 """Execution of fixture setup."""
11581156 kwargs = {}
@@ -1525,7 +1523,7 @@ def __init__(self, session: Session) -> None:
15251523 # suite/plugins defined with this name. Populated by parsefactories().
15261524 # TODO: The order of the FixtureDefs list of each arg is significant,
15271525 # explain.
1528- self ._arg2fixturedefs : Final [dict [str , list [FixtureDef [Any , Any ]]]] = {}
1526+ self ._arg2fixturedefs : Final [dict [str , list [FixtureDef [Any ]]]] = {}
15291527 self ._holderobjseen : Final [set [object ]] = set ()
15301528 # A mapping from a nodeid to a list of autouse fixtures it defines.
15311529 self ._nodeid_autousenames : Final [dict [str , list [str ]]] = {
@@ -1616,7 +1614,7 @@ def getfixtureclosure(
16161614 parentnode : nodes .Node ,
16171615 initialnames : tuple [str , ...],
16181616 ignore_args : AbstractSet [str ],
1619- ) -> tuple [list [str ], dict [str , Sequence [FixtureDef [Any , Any ]]]]:
1617+ ) -> tuple [list [str ], dict [str , Sequence [FixtureDef [Any ]]]]:
16201618 # Collect the closure of all fixtures, starting with the given
16211619 # fixturenames as the initial set. As we have to visit all
16221620 # factory definitions anyway, we also return an arg2fixturedefs
@@ -1626,7 +1624,7 @@ def getfixtureclosure(
16261624
16271625 fixturenames_closure = list (initialnames )
16281626
1629- arg2fixturedefs : dict [str , Sequence [FixtureDef [Any , Any ]]] = {}
1627+ arg2fixturedefs : dict [str , Sequence [FixtureDef [Any ]]] = {}
16301628 lastlen = - 1
16311629 while lastlen != len (fixturenames_closure ):
16321630 lastlen = len (fixturenames_closure )
@@ -1841,7 +1839,7 @@ def parsefactories(
18411839
18421840 def getfixturedefs (
18431841 self , argname : str , node : nodes .Node
1844- ) -> Sequence [FixtureDef [Any , Any ]] | None :
1842+ ) -> Sequence [FixtureDef [Any ]] | None :
18451843 """Get FixtureDefs for a fixture name which are applicable
18461844 to a given node.
18471845
@@ -1860,8 +1858,8 @@ def getfixturedefs(
18601858 return tuple (self ._matchfactories (fixturedefs , node ))
18611859
18621860 def _matchfactories (
1863- self , fixturedefs : Iterable [FixtureDef [Any , Any ]], node : nodes .Node
1864- ) -> Iterator [FixtureDef [Any , Any ]]:
1861+ self , fixturedefs : Iterable [FixtureDef [Any ]], node : nodes .Node
1862+ ) -> Iterator [FixtureDef [Any ]]:
18651863 parentnodeids = {n .nodeid for n in node .iter_parents ()}
18661864 for fixturedef in fixturedefs :
18671865 if fixturedef .baseid in parentnodeids :
@@ -1898,7 +1896,7 @@ def get_best_relpath(func) -> str:
18981896 loc = getlocation (func , invocation_dir )
18991897 return bestrelpath (invocation_dir , Path (loc ))
19001898
1901- def write_fixture (fixture_def : FixtureDef [Any , object ]) -> None :
1899+ def write_fixture (fixture_def : FixtureDef [object ]) -> None :
19021900 argname = fixture_def .argname
19031901 if verbose <= 0 and argname .startswith ("_" ):
19041902 return
0 commit comments