diff --git a/tests/examples/conftest.py b/tests/examples/conftest.py index 0c061ea4d..76b63e69a 100644 --- a/tests/examples/conftest.py +++ b/tests/examples/conftest.py @@ -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) diff --git a/tests/examples/utils.py b/tests/examples/utils.py index 21d7f429b..a597f6bb7 100644 --- a/tests/examples/utils.py +++ b/tests/examples/utils.py @@ -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))