Fix fixture lookup in pytest_generate_tests
Signed-off-by: Kirill Sosnovskikh <k.sosnovskikh@yadro.com>
This commit is contained in:
parent
156c32a0cb
commit
65fab7f1c5
2 changed files with 20 additions and 16 deletions
|
@ -21,7 +21,7 @@ Additionally, `allure-validator` can be added to pre-commit hooks:
|
||||||
# .pre-commit-config.yaml
|
# .pre-commit-config.yaml
|
||||||
repos:
|
repos:
|
||||||
- repo: https://git.frostfs.info/TrueCloudLab/allure-validator
|
- repo: https://git.frostfs.info/TrueCloudLab/allure-validator
|
||||||
rev: 1.0.0
|
rev: latest
|
||||||
hooks:
|
hooks:
|
||||||
- id: allure-validator
|
- id: allure-validator
|
||||||
args: ["pytest_tests/"]
|
args: ["pytest_tests/"]
|
||||||
|
|
|
@ -133,9 +133,13 @@ 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
|
||||||
|
|
||||||
|
if parse.decorator(node.value) != PYTEST_METAFUNC_PARAMETRIZE:
|
||||||
|
continue
|
||||||
|
|
||||||
fixture_names = parse.param_names(node.value.args[0])
|
fixture_names = parse.param_names(node.value.args[0])
|
||||||
for name in fixture_names:
|
for name in fixture_names:
|
||||||
# Dynamic fake fixture
|
# Dynamic fake fixture
|
||||||
|
|
Loading…
Reference in a new issue