fixtures: remove a level of indentation

A bit easier to follow.
This commit is contained in:
Ran Benita 2024-02-21 09:58:59 +02:00
parent 79def57cc6
commit 2007cf6296
1 changed files with 22 additions and 24 deletions

View File

@ -169,16 +169,14 @@ def get_parametrized_fixture_keys(
the specified scope."""
assert scope is not Scope.Function
try:
callspec = item.callspec # type: ignore[attr-defined]
callspec: CallSpec2 = item.callspec # type: ignore[attr-defined]
except AttributeError:
pass
else:
cs: CallSpec2 = callspec
return
# cs.indices is random order of argnames. Need to
# sort this so that different calls to
# get_parametrized_fixture_keys will be deterministic.
for argname in sorted(cs.indices):
if cs._arg2scope[argname] != scope:
for argname in sorted(callspec.indices):
if callspec._arg2scope[argname] != scope:
continue
item_cls = None
@ -194,7 +192,7 @@ def get_parametrized_fixture_keys(
else:
assert_never(scope)
param_index = cs.indices[argname]
param_index = callspec.indices[argname]
yield FixtureArgKey(argname, param_index, scoped_item_path, item_cls)