55import warnings
66from collections import defaultdict
77from collections import deque
8+ from collections .abc import Hashable
89from contextlib import suppress
910from pathlib import Path
1011from types import TracebackType
@@ -601,6 +602,7 @@ def _compute_fixture_value(self, fixturedef: "FixtureDef[object]") -> None:
601602 except (AttributeError , ValueError ):
602603 param = NOTSET
603604 param_index = 0
605+ param_key = ""
604606 has_params = fixturedef .params is not None
605607 fixtures_not_supported = getattr (funcitem , "nofuncargs" , False )
606608 if has_params and fixtures_not_supported :
@@ -640,13 +642,14 @@ def _compute_fixture_value(self, fixturedef: "FixtureDef[object]") -> None:
640642 fail (msg , pytrace = False )
641643 else :
642644 param_index = funcitem .callspec .indices [argname ]
645+ param_key = funcitem .callspec .param_keys [argname ]
643646 # If a parametrize invocation set a scope it will override
644647 # the static scope defined with the fixture function.
645648 with suppress (KeyError ):
646649 scope = funcitem .callspec ._arg2scope [argname ]
647650
648651 subrequest = SubRequest (
649- self , scope , param , param_index , fixturedef , _ispytest = True
652+ self , scope , param , param_index , param_key , fixturedef , _ispytest = True
650653 )
651654
652655 # Check if a higher-level scoped fixture accesses a lower level one.
@@ -731,6 +734,7 @@ def __init__(
731734 scope : Scope ,
732735 param : Any ,
733736 param_index : int ,
737+ param_key : Hashable ,
734738 fixturedef : "FixtureDef[object]" ,
735739 * ,
736740 _ispytest : bool = False ,
@@ -741,6 +745,7 @@ def __init__(
741745 if param is not NOTSET :
742746 self .param = param
743747 self .param_index = param_index
748+ self .param_key = param_key
744749 self ._scope = scope
745750 self ._fixturedef = fixturedef
746751 self ._pyfuncitem = request ._pyfuncitem
0 commit comments