forked from TrueCloudLab/allure-validator
Compare commits
2 commits
f7b790b93a
...
dba27032e4
Author | SHA1 | Date | |
---|---|---|---|
dba27032e4 | |||
76ba757964 |
2 changed files with 22 additions and 21 deletions
|
@ -20,15 +20,12 @@ Additionally, `allure-validator` can be added to pre-commit hooks:
|
|||
```yaml
|
||||
# .pre-commit-config.yaml
|
||||
repos:
|
||||
- repo: local
|
||||
- repo: https://git.frostfs.info/TrueCloudLab/allure-validator
|
||||
rev: 1.0.0
|
||||
hooks:
|
||||
- id: allure-validator
|
||||
name: allure-validator
|
||||
entry: allure-validator
|
||||
language: system
|
||||
args: ["pytest_tests/"] # folder with tests
|
||||
args: ["pytest_tests/"]
|
||||
pass_filenames: false
|
||||
types: [python]
|
||||
```
|
||||
|
||||
### Ignore mechanism
|
||||
|
|
|
@ -133,21 +133,25 @@ def fixtures(ast_fixtures: list[ast.FunctionDef], ast_hooks: list[ast.FunctionDe
|
|||
|
||||
for ast_hook in ast_hooks:
|
||||
path = getattr(ast_hook, ATTR_PATH)
|
||||
for node in ast_hook.body:
|
||||
if isinstance(node, ast.Expr):
|
||||
if parse.decorator(node.value) == PYTEST_METAFUNC_PARAMETRIZE:
|
||||
fixture_names = parse.param_names(node.value.args[0])
|
||||
for name in fixture_names:
|
||||
# Dynamic fake fixture
|
||||
fixture = Fixture(
|
||||
name,
|
||||
path,
|
||||
node.lineno,
|
||||
node.col_offset,
|
||||
args=[],
|
||||
params=["parametrized"],
|
||||
)
|
||||
fixtures[fixture] = fixture
|
||||
for node in ast.walk(ast_hook):
|
||||
if not isinstance(node, ast.Expr):
|
||||
continue
|
||||
|
||||
if parse.decorator(node.value) != PYTEST_METAFUNC_PARAMETRIZE:
|
||||
continue
|
||||
|
||||
fixture_names = parse.param_names(node.value.args[0])
|
||||
for name in fixture_names:
|
||||
# Dynamic fake fixture
|
||||
fixture = Fixture(
|
||||
name,
|
||||
path,
|
||||
node.lineno,
|
||||
node.col_offset,
|
||||
args=[],
|
||||
params=["parametrized"],
|
||||
)
|
||||
fixtures[fixture] = fixture
|
||||
|
||||
for fixture in fixtures.values():
|
||||
for arg in fixture.args:
|
||||
|
|
Loading…
Add table
Reference in a new issue