This commit is contained in:
Julio Castillo
2026-04-27 12:15:57 +02:00
parent 99f53d37f0
commit ff529cc4f3
2 changed files with 5 additions and 2 deletions

View File

@@ -50,6 +50,8 @@ def pytest_generate_tests(metafunc, test_group='example',
examples.append(pytest.param(example, marks=pytest_marks))
ids.append(example_id)
elif isinstance(example, YamlExample):
if not filter_tests(example.directive.args):
continue
examples.append(pytest.param(example))
ids.append(example_id)

View File

@@ -21,7 +21,8 @@ import marko
Directive = collections.namedtuple('Directive', 'name args kwargs')
TerraformExample = collections.namedtuple(
'TerraformExample', 'name code module files fixtures type directive')
YamlExample = collections.namedtuple('YamlExample', 'body module schema')
YamlExample = collections.namedtuple('YamlExample',
'body module schema directive')
File = collections.namedtuple('File', 'path content')
@@ -100,7 +101,7 @@ def get_readme_examples(readme_path, fabric_root):
schema = directive.kwargs.get('schema')
if directive.name == "tftest-file" and schema:
schema = module / 'schemas' / schema
example = YamlExample(code, module, schema)
example = YamlExample(code, module, schema, directive)
yaml_path = directive.kwargs['path']
example_id = f'yaml:{path}:{last_header}:{yaml_path}:{index}'
examples.append((example, example_id, [], last_header, index))