From b28e4968044430f138d76156868044e9287660f3 Mon Sep 17 00:00:00 2001 From: Jennifer Power Date: Thu, 26 Oct 2023 15:55:35 -0400 Subject: [PATCH] fix(entrypoint): fixes top level ModelFilter logic (#71) * fix(entrypoint): fixes top level ModelFilter logic Replace "." with "*" for include all logic Adds tests to ModelFilter to validate Signed-off-by: Jennifer Power * fix: fixes formatting Signed-off-by: Jennifer Power --------- Signed-off-by: Jennifer Power --- tests/trestlebot/tasks/test_assemble_task.py | 2 +- tests/trestlebot/tasks/test_base_task.py | 4 +++- tests/trestlebot/tasks/test_regenerate_task.py | 2 +- trestlebot/entrypoints/autosync.py | 2 +- trestlebot/entrypoints/rule_transform.py | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/trestlebot/tasks/test_assemble_task.py b/tests/trestlebot/tasks/test_assemble_task.py index 5c3bfa80..ad963dc2 100644 --- a/tests/trestlebot/tasks/test_assemble_task.py +++ b/tests/trestlebot/tasks/test_assemble_task.py @@ -96,7 +96,7 @@ def test_assemble_task_with_skip(tmp_trestle_dir: str, skip_list: List[str]) -> mock = Mock(spec=AuthorObjectBase) - filter = ModelFilter(skip_list, ["."]) + filter = ModelFilter(skip_list, ["*"]) assemble_task = AssembleTask( working_dir=tmp_trestle_dir, diff --git a/tests/trestlebot/tasks/test_base_task.py b/tests/trestlebot/tasks/test_base_task.py index b2887c3c..67462786 100644 --- a/tests/trestlebot/tasks/test_base_task.py +++ b/tests/trestlebot/tasks/test_base_task.py @@ -29,13 +29,15 @@ [ [["simplified_nist_catalog"], [], "simplified_nist_catalog", True], [[], ["simplified_nist_catalog"], "simplified_nist_catalog", False], - [["simplified*"], ["."], "simplified_nist_catalog", True], + [["simplified*"], ["*"], "simplified_nist_catalog", True], [ ["simplified_nist_catalog"], ["simplified*"], "simplified_nist_profile", False, ], + [[], [], "simplified_nist_catalog", True], + [[], ["*"], "simplified_nist_catalog", False], ], ) def test_is_skipped( diff --git a/tests/trestlebot/tasks/test_regenerate_task.py b/tests/trestlebot/tasks/test_regenerate_task.py index 6000b107..4da542ec 100644 --- a/tests/trestlebot/tasks/test_regenerate_task.py +++ b/tests/trestlebot/tasks/test_regenerate_task.py @@ -87,7 +87,7 @@ def test_regenerate_task_with_skip(tmp_trestle_dir: str, skip_list: List[str]) - mock = Mock(spec=AuthorObjectBase) - filter = ModelFilter(skip_list, ["."]) + filter = ModelFilter(skip_list, ["*"]) regenerate_task = RegenerateTask( working_dir=tmp_trestle_dir, diff --git a/trestlebot/entrypoints/autosync.py b/trestlebot/entrypoints/autosync.py index 3f638976..36fe0053 100644 --- a/trestlebot/entrypoints/autosync.py +++ b/trestlebot/entrypoints/autosync.py @@ -122,7 +122,7 @@ def run(self, args: argparse.Namespace) -> None: filter: ModelFilter = ModelFilter( skip_patterns=comma_sep_to_list(args.skip_items), - include_patterns=["."], + include_patterns=["*"], ) # Assuming an edit has occurred assemble would be run before regenerate. diff --git a/trestlebot/entrypoints/rule_transform.py b/trestlebot/entrypoints/rule_transform.py index 15eee2e8..df197ffd 100644 --- a/trestlebot/entrypoints/rule_transform.py +++ b/trestlebot/entrypoints/rule_transform.py @@ -65,7 +65,7 @@ def run(self, args: argparse.Namespace) -> None: filter: ModelFilter = ModelFilter( skip_patterns=comma_sep_to_list(args.skip_items), - include_patterns=["."], + include_patterns=["*"], ) rule_transform_task: RuleTransformTask = RuleTransformTask(