Skip to content

Commit

Permalink
fix(study-filesystem): check that the children exist in FileStudyTree
Browse files Browse the repository at this point in the history
  • Loading branch information
laurent-laporte-pro committed Mar 1, 2024
1 parent a7506d0 commit 7c685ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def build(self) -> TREE:
"user": User(self.context, self.config.next_file("user")),
}

children = {key: node for key, node in children.items() if node.config.path.exists()}

if self.config.outputs:
output_config = self.config.next_file("output")
output_config.path = self.config.output_path or output_config.path
Expand Down
7 changes: 3 additions & 4 deletions tests/storage/repository/filesystem/test_folder_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def test_get_input_areas_sets(tmp_path: Path) -> None:
url = ["input", "areas", "sets"] # sets.ini

# Empty study tree structure
actual = file_study.tree.get(url)
assert actual == {}
with pytest.raises(ChildNotFoundError, match=r"'input' not a child of FileStudyTree"):
file_study.tree.get(url)

# Add the "settings" directory
tmp_path.joinpath("input").mkdir()
Expand Down Expand Up @@ -105,8 +105,7 @@ def test_get_user_expansion_sensitivity_sensitivity_in(tmp_path: Path) -> None:
url = ["user", "expansion", "sensitivity", "sensitivity_in"]

# Empty study tree structure
# fixme: bad error message
with pytest.raises(ChildNotFoundError, match=r"'expansion' not a child of User"):
with pytest.raises(ChildNotFoundError, match=r"'user' not a child of FileStudyTree"):
file_study.tree.get(url)

# Add the "user" directory
Expand Down

0 comments on commit 7c685ba

Please sign in to comment.