@@ -169,33 +169,28 @@ def get_parametrized_fixture_keys(
169
169
the specified scope."""
170
170
assert scope is not Scope .Function
171
171
try :
172
- callspec = item .callspec # type: ignore[attr-defined]
172
+ callspec : CallSpec2 = item .callspec # type: ignore[attr-defined]
173
173
except AttributeError :
174
- pass
175
- else :
176
- cs : CallSpec2 = callspec
177
- # cs.indices is random order of argnames. Need to
178
- # sort this so that different calls to
179
- # get_parametrized_fixture_keys will be deterministic.
180
- for argname in sorted (cs .indices ):
181
- if cs ._arg2scope [argname ] != scope :
182
- continue
183
-
184
- item_cls = None
185
- if scope is Scope .Session :
186
- scoped_item_path = None
187
- elif scope is Scope .Package :
188
- scoped_item_path = item .path
189
- elif scope is Scope .Module :
190
- scoped_item_path = item .path
191
- elif scope is Scope .Class :
192
- scoped_item_path = item .path
193
- item_cls = item .cls # type: ignore[attr-defined]
194
- else :
195
- assert_never (scope )
174
+ return
175
+ for argname in callspec .indices :
176
+ if callspec ._arg2scope [argname ] != scope :
177
+ continue
178
+
179
+ item_cls = None
180
+ if scope is Scope .Session :
181
+ scoped_item_path = None
182
+ elif scope is Scope .Package :
183
+ scoped_item_path = item .path
184
+ elif scope is Scope .Module :
185
+ scoped_item_path = item .path
186
+ elif scope is Scope .Class :
187
+ scoped_item_path = item .path
188
+ item_cls = item .cls # type: ignore[attr-defined]
189
+ else :
190
+ assert_never (scope )
196
191
197
- param_index = cs .indices [argname ]
198
- yield FixtureArgKey (argname , param_index , scoped_item_path , item_cls )
192
+ param_index = callspec .indices [argname ]
193
+ yield FixtureArgKey (argname , param_index , scoped_item_path , item_cls )
199
194
200
195
201
196
# Algorithm for sorting on a per-parametrized resource setup basis.
0 commit comments