diff --git a/antarest/study/storage/abstract_storage_service.py b/antarest/study/storage/abstract_storage_service.py index 69f3156755..153c94ae55 100644 --- a/antarest/study/storage/abstract_storage_service.py +++ b/antarest/study/storage/abstract_storage_service.py @@ -81,7 +81,6 @@ def export_study_flat( ) shutil.copytree(src=path_study, dst=dest, ignore=ignore_patterns) - if outputs and output_src_path.is_dir(): if output_dest_path.exists(): shutil.rmtree(output_dest_path) diff --git a/tests/storage/business/test_export.py b/tests/storage/business/test_export.py index df4697a004..1764807418 100644 --- a/tests/storage/business/test_export.py +++ b/tests/storage/business/test_export.py @@ -8,6 +8,7 @@ from antarest.core.config import Config, StorageConfig from antarest.study.model import DEFAULT_WORKSPACE_NAME, RawStudy from antarest.study.storage.rawstudy.raw_study_service import RawStudyService +from antarest.study.storage.abstract_storage_service import export_study_flat @pytest.mark.unit_test @@ -105,17 +106,17 @@ def test_export_flat(tmp_path: Path): study_factory.create_from_fs.return_value = study_tree study = RawStudy(id="id", path=root) + path_study = Path(study.path) - study_service.export_study_flat( - study, tmp_path / "copy_with_output", outputs=True - ) + export_study_flat(path_study, tmp_path / "copy_with_output", outputs=True) copy_with_output_hash = dirhash(tmp_path / "copy_with_output", "md5") assert root_hash == copy_with_output_hash - study_service.export_study_flat( - study, tmp_path / "copy_without_output", outputs=False + path_study = Path(study.path) + export_study_flat( + path_study, tmp_path / "copy_without_output", outputs=False ) copy_without_output_hash = dirhash(tmp_path / "copy_without_output", "md5") diff --git a/tests/storage/integration/test_exporter.py b/tests/storage/integration/test_exporter.py index 355d5bf462..9a83fd212c 100644 --- a/tests/storage/integration/test_exporter.py +++ b/tests/storage/integration/test_exporter.py @@ -16,7 +16,7 @@ from antarest.matrixstore.service import MatrixService from antarest.study.main import build_study_service from antarest.study.model import DEFAULT_WORKSPACE_NAME, RawStudy -from antarest.study.storage.utils import export_study_flat +from antarest.study.storage.abstract_storage_service import export_study_flat from antarest.study.storage.variantstudy.business.matrix_constants_generator import ( GeneratorMatrixConstants, ) @@ -103,13 +103,11 @@ def test_exporter_file_no_output( @pytest.mark.parametrize( "output_list", [None, [], ["20201014-1427eco"], ["20201014-1430adq-2"]] ) -@pytest.mark.parametrize("denormalize", [True, False]) def test_export_flat( tmp_path: Path, sta_mini_zip_path: Path, outputs: bool, output_list: Optional[List[str]], - denormalize: bool, ) -> None: path_studies = tmp_path / "studies" path_studies.mkdir(exist_ok=True) @@ -123,10 +121,8 @@ def test_export_flat( export_study_flat( path_studies / "STA-mini", export_path / "STA-mini-export", - Mock(), outputs, output_list, - denormalize=denormalize, ) export_output_path = export_path / "STA-mini-export" / "output"