fix dependent_fixtures_argnames
This commit is contained in:
parent
a56e25154b
commit
c0daf2830e
|
@ -1508,15 +1508,18 @@ class FixtureManager:
|
||||||
def dependent_fixtures_argnames(
|
def dependent_fixtures_argnames(
|
||||||
fixture_defs: Sequence[FixtureDef[Any]],
|
fixture_defs: Sequence[FixtureDef[Any]],
|
||||||
) -> List[str]:
|
) -> List[str]:
|
||||||
last_fixture = fixture_defs[-1]
|
|
||||||
# Initialize with the argnames of the last fixture
|
# Initialize with the argnames of the last fixture
|
||||||
dependent_argnames = list(last_fixture.argnames)
|
dependent_argnames = list(fixture_defs[-1].argnames)
|
||||||
for arg in fixture_defs:
|
# Iterate over the list in reverse order, skipping the last element already processed.
|
||||||
if arg.argname in last_fixture.argnames:
|
for index, current_fixture in enumerate(
|
||||||
# Add new argument names maintaining order and avoiding duplicates
|
reversed(fixture_defs[:-1]), start=1
|
||||||
for argname in arg.argnames:
|
):
|
||||||
|
if current_fixture.argname in fixture_defs[-index].argnames:
|
||||||
|
for argname in current_fixture.argnames:
|
||||||
if argname not in dependent_argnames:
|
if argname not in dependent_argnames:
|
||||||
dependent_argnames.append(argname)
|
dependent_argnames.append(argname)
|
||||||
|
else:
|
||||||
|
break
|
||||||
return dependent_argnames
|
return dependent_argnames
|
||||||
|
|
||||||
fixturenames_closure = list(initialnames)
|
fixturenames_closure = list(initialnames)
|
||||||
|
|
Loading…
Reference in New Issue