Skip to content

Commit

Permalink
fix(entrypoint): fixes top level ModelFilter logic
Browse files Browse the repository at this point in the history
Replace "." with "*" for include all logic
Adds tests to ModelFilter to validate

Signed-off-by: Jennifer Power <[email protected]>
  • Loading branch information
jpower432 committed Oct 26, 2023
1 parent 8cae7bc commit 1ccef66
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/trestlebot/tasks/test_assemble_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 5 additions & 4 deletions tests/trestlebot/tasks/test_base_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,19 @@
[
[["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(
skip_list: List[str], include_list: List[str], model_name: str, expected: str
) -> None:
def test_is_skipped(skip_list: List[str], include_list: List[str],
model_name: str, expected: str) -> None:
"""Test skip logic."""
model_path = pathlib.Path(model_name)
model_filter = ModelFilter(skip_list, include_list)
Expand Down
2 changes: 1 addition & 1 deletion tests/trestlebot/tasks/test_regenerate_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion trestlebot/entrypoints/autosync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion trestlebot/entrypoints/rule_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 1ccef66

Please sign in to comment.