Skip to content

Commit

Permalink
test(archive-config): rename "zip_path" to "archive_path"
Browse files Browse the repository at this point in the history
  • Loading branch information
mabw-rte committed May 26, 2024
1 parent da373bb commit bb56aa4
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def build(study_path: Path, study_id: str, output_path: t.Optional[Path] = None)
store_new_set=sns,
archive_input_series=asi,
enr_modelling=enr_modelling,
zip_path=study_path if is_archive else None,
archive_path=study_path if is_archive else None,
)


Expand Down
16 changes: 8 additions & 8 deletions antarest/study/storage/rawstudy/model/filesystem/config/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def __init__(
archive_input_series: t.Optional[t.List[str]] = None,
enr_modelling: str = EnrModelling.AGGREGATED.value,
cache: t.Optional[t.Dict[str, t.List[str]]] = None,
zip_path: t.Optional[Path] = None,
archive_path: t.Optional[Path] = None,
):
self.study_path = study_path
self.path = path
Expand All @@ -142,13 +142,13 @@ def __init__(
self.archive_input_series = archive_input_series or []
self.enr_modelling = enr_modelling
self.cache = cache or {}
self.archive_path = zip_path
self.archive_path = archive_path

def next_file(self, name: str, is_output: bool = False) -> "FileStudyTreeConfig":
if is_output and name in self.outputs and self.outputs[name].archived:
zip_path: t.Optional[Path] = self.path / f"{name}.zip"
archive_path: t.Optional[Path] = self.path / f"{name}.zip"
else:
zip_path = self.archive_path
archive_path = self.archive_path

return FileStudyTreeConfig(
study_path=self.study_path,
Expand All @@ -164,7 +164,7 @@ def next_file(self, name: str, is_output: bool = False) -> "FileStudyTreeConfig"
archive_input_series=self.archive_input_series,
enr_modelling=self.enr_modelling,
cache=self.cache,
zip_path=zip_path,
archive_path=archive_path,
)

def at_file(self, filepath: Path) -> "FileStudyTreeConfig":
Expand Down Expand Up @@ -261,7 +261,7 @@ class FileStudyTreeConfigDTO(BaseModel):
store_new_set: bool = False
archive_input_series: t.List[str] = list()
enr_modelling: str = EnrModelling.AGGREGATED.value
zip_path: t.Optional[Path] = None
archive_path: t.Optional[Path] = None

@staticmethod
def from_build_config(
Expand All @@ -280,7 +280,7 @@ def from_build_config(
store_new_set=config.store_new_set,
archive_input_series=config.archive_input_series,
enr_modelling=config.enr_modelling,
zip_path=config.archive_path,
archive_path=config.archive_path,
)

def to_build_config(self) -> FileStudyTreeConfig:
Expand All @@ -297,5 +297,5 @@ def to_build_config(self) -> FileStudyTreeConfig:
store_new_set=self.store_new_set,
archive_input_series=self.archive_input_series,
enr_modelling=self.enr_modelling,
zip_path=self.zip_path,
archive_path=self.archive_path,
)
Original file line number Diff line number Diff line change
Expand Up @@ -1595,5 +1595,5 @@
"store_new_set": true,
"archive_input_series": [],
"enr_modelling": "aggregated",
"zip_path": null
"archive_path": null
}
Original file line number Diff line number Diff line change
Expand Up @@ -1523,5 +1523,5 @@
"store_new_set": true,
"archive_input_series": [],
"enr_modelling": "aggregated",
"zip_path": null
"archive_path": null
}
2 changes: 1 addition & 1 deletion tests/storage/repository/filesystem/test_folder_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
def build_tree() -> INode[t.Any, t.Any, t.Any]:
config = Mock()
config.path.exist.return_value = True
config.zip_path = None
config.archive_path = None
return TestMiddleNode(
context=Mock(),
config=config,
Expand Down
4 changes: 2 additions & 2 deletions tests/storage/repository/filesystem/test_ini_file_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_get(tmp_path: Path) -> None:
areas={},
outputs={},
study_id="id",
zip_path=zipped_path,
archive_path=zipped_path,
),
types=types,
)
Expand Down Expand Up @@ -135,7 +135,7 @@ def test_get_depth(tmp_path: Path) -> None:
areas={},
outputs={},
study_id="id",
zip_path=zipped_path,
archive_path=zipped_path,
),
types=types,
)
Expand Down
2 changes: 1 addition & 1 deletion tests/storage/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1470,7 +1470,7 @@ def test_get_save_logs(tmp_path: Path):
study_mock.name = "my_study"
study_mock.to_json_summary.return_value = {"id": "my_study", "name": "foo"}
service.repository.get.return_value = study_mock
file_study_config = FileStudyTreeConfig(tmp_path, tmp_path, "study_id", 0, zip_path=None)
file_study_config = FileStudyTreeConfig(tmp_path, tmp_path, "study_id", 0, archive_path=None)
output_config = Mock()
file_study_config.outputs = {"output_id": output_config}
output_config.get_file.return_value = "output_id"
Expand Down

0 comments on commit bb56aa4

Please sign in to comment.