fixtures: remove a level of indentation
A bit easier to follow.
This commit is contained in:
parent
79def57cc6
commit
2007cf6296
|
@ -169,33 +169,31 @@ def get_parametrized_fixture_keys(
|
||||||
the specified scope."""
|
the specified scope."""
|
||||||
assert scope is not Scope.Function
|
assert scope is not Scope.Function
|
||||||
try:
|
try:
|
||||||
callspec = item.callspec # type: ignore[attr-defined]
|
callspec: CallSpec2 = item.callspec # type: ignore[attr-defined]
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
return
|
||||||
else:
|
# cs.indices is random order of argnames. Need to
|
||||||
cs: CallSpec2 = callspec
|
# sort this so that different calls to
|
||||||
# cs.indices is random order of argnames. Need to
|
# get_parametrized_fixture_keys will be deterministic.
|
||||||
# sort this so that different calls to
|
for argname in sorted(callspec.indices):
|
||||||
# get_parametrized_fixture_keys will be deterministic.
|
if callspec._arg2scope[argname] != scope:
|
||||||
for argname in sorted(cs.indices):
|
continue
|
||||||
if cs._arg2scope[argname] != scope:
|
|
||||||
continue
|
|
||||||
|
|
||||||
item_cls = None
|
item_cls = None
|
||||||
if scope is Scope.Session:
|
if scope is Scope.Session:
|
||||||
scoped_item_path = None
|
scoped_item_path = None
|
||||||
elif scope is Scope.Package:
|
elif scope is Scope.Package:
|
||||||
scoped_item_path = item.path
|
scoped_item_path = item.path
|
||||||
elif scope is Scope.Module:
|
elif scope is Scope.Module:
|
||||||
scoped_item_path = item.path
|
scoped_item_path = item.path
|
||||||
elif scope is Scope.Class:
|
elif scope is Scope.Class:
|
||||||
scoped_item_path = item.path
|
scoped_item_path = item.path
|
||||||
item_cls = item.cls # type: ignore[attr-defined]
|
item_cls = item.cls # type: ignore[attr-defined]
|
||||||
else:
|
else:
|
||||||
assert_never(scope)
|
assert_never(scope)
|
||||||
|
|
||||||
param_index = cs.indices[argname]
|
param_index = callspec.indices[argname]
|
||||||
yield FixtureArgKey(argname, param_index, scoped_item_path, item_cls)
|
yield FixtureArgKey(argname, param_index, scoped_item_path, item_cls)
|
||||||
|
|
||||||
|
|
||||||
# Algorithm for sorting on a per-parametrized resource setup basis.
|
# Algorithm for sorting on a per-parametrized resource setup basis.
|
||||||
|
|
Loading…
Reference in New Issue