From 0d3f69c576e99d913f57e2da4cb8807d9957a6f2 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Mon, 13 May 2024 16:02:17 +0100 Subject: [PATCH] Refactor globs test (#4157) --- examples/playbooks_globs/a.yml | 4 ++++ examples/playbooks_globs/b.yml | 4 ++++ test/test_runner.py | 6 +++--- 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 examples/playbooks_globs/a.yml create mode 100644 examples/playbooks_globs/b.yml diff --git a/examples/playbooks_globs/a.yml b/examples/playbooks_globs/a.yml new file mode 100644 index 0000000000..37b6d9ee6e --- /dev/null +++ b/examples/playbooks_globs/a.yml @@ -0,0 +1,4 @@ +--- +- name: A + hosts: localhost + tasks: [] diff --git a/examples/playbooks_globs/b.yml b/examples/playbooks_globs/b.yml new file mode 100644 index 0000000000..19f17c5b1c --- /dev/null +++ b/examples/playbooks_globs/b.yml @@ -0,0 +1,4 @@ +--- +- # missing name + hosts: localhost + tasks: [] diff --git a/test/test_runner.py b/test/test_runner.py index d12e6c924a..c87ac60409 100644 --- a/test/test_runner.py +++ b/test/test_runner.py @@ -89,7 +89,7 @@ def test_runner_exclude_paths(default_rules_collection: RulesCollection) -> None @pytest.mark.parametrize( ("exclude_path"), - (pytest.param("**/playbooks/*.yml", id="1"),), + (pytest.param("**/playbooks_globs/*b.yml", id="1"),), ) def test_runner_exclude_globs( default_rules_collection: RulesCollection, @@ -97,13 +97,13 @@ def test_runner_exclude_globs( ) -> None: """Test that globs work.""" runner = Runner( - "examples/playbooks", + "examples/playbooks_globs", rules=default_rules_collection, exclude_paths=[exclude_path], ) matches = runner.run() - assert len(matches) == 83 + assert len(matches) == 0 @pytest.mark.parametrize(