forked from TrueCloudLab/allure-validator
Fix fixture lookup in pytest_generate_tests
Signed-off-by: Kirill Sosnovskikh <k.sosnovskikh@yadro.com>
This commit is contained in:
parent
76ba757964
commit
dba27032e4
1 changed files with 19 additions and 15 deletions
|
@ -133,21 +133,25 @@ def fixtures(ast_fixtures: list[ast.FunctionDef], ast_hooks: list[ast.FunctionDe
|
||||||
|
|
||||||
for ast_hook in ast_hooks:
|
for ast_hook in ast_hooks:
|
||||||
path = getattr(ast_hook, ATTR_PATH)
|
path = getattr(ast_hook, ATTR_PATH)
|
||||||
for node in ast_hook.body:
|
for node in ast.walk(ast_hook):
|
||||||
if isinstance(node, ast.Expr):
|
if not isinstance(node, ast.Expr):
|
||||||
if parse.decorator(node.value) == PYTEST_METAFUNC_PARAMETRIZE:
|
continue
|
||||||
fixture_names = parse.param_names(node.value.args[0])
|
|
||||||
for name in fixture_names:
|
if parse.decorator(node.value) != PYTEST_METAFUNC_PARAMETRIZE:
|
||||||
# Dynamic fake fixture
|
continue
|
||||||
fixture = Fixture(
|
|
||||||
name,
|
fixture_names = parse.param_names(node.value.args[0])
|
||||||
path,
|
for name in fixture_names:
|
||||||
node.lineno,
|
# Dynamic fake fixture
|
||||||
node.col_offset,
|
fixture = Fixture(
|
||||||
args=[],
|
name,
|
||||||
params=["parametrized"],
|
path,
|
||||||
)
|
node.lineno,
|
||||||
fixtures[fixture] = fixture
|
node.col_offset,
|
||||||
|
args=[],
|
||||||
|
params=["parametrized"],
|
||||||
|
)
|
||||||
|
fixtures[fixture] = fixture
|
||||||
|
|
||||||
for fixture in fixtures.values():
|
for fixture in fixtures.values():
|
||||||
for arg in fixture.args:
|
for arg in fixture.args:
|
||||||
|
|
Loading…
Reference in a new issue