diff --git a/antarest/core/filesystem_blueprint.py b/antarest/core/filesystem_blueprint.py index 02652f2213..6fdaeb2e02 100644 --- a/antarest/core/filesystem_blueprint.py +++ b/antarest/core/filesystem_blueprint.py @@ -95,7 +95,7 @@ class MountPointDTO( message: str = Field("", description="A message describing the status of the mount point") @classmethod - async def from_path(cls, name: str, path: Path) -> "MountPointDTO": + def from_path(cls, name: str, path: Path) -> "MountPointDTO": obj = cls(name=name, path=path) try: obj.total_bytes, obj.used_bytes, obj.free_bytes = shutil.disk_usage(obj.path) @@ -335,9 +335,7 @@ async def list_mount_points(fs: FilesystemName) -> t.Sequence[MountPointDTO]: """ mount_dirs = _get_mount_dirs(fs) - tasks = [MountPointDTO.from_path(name, path) for name, path in mount_dirs.items()] - ws = await asyncio.gather(*tasks) - return ws + return [MountPointDTO.from_path(name, path) for name, path in mount_dirs.items()] @bp.get( "/{fs}/{mount}", @@ -365,7 +363,7 @@ async def get_mount_point(fs: FilesystemName, mount: MountPointName) -> MountPoi """ mount_dir = _get_mount_dir(fs, mount) - return await MountPointDTO.from_path(mount, mount_dir) + return MountPointDTO.from_path(mount, mount_dir) @bp.get( "/{fs}/{mount}/ls", diff --git a/tests/integration/filesystem_blueprint/test_model.py b/tests/integration/filesystem_blueprint/test_model.py index 2e4932dd9c..67f5518f1d 100644 --- a/tests/integration/filesystem_blueprint/test_model.py +++ b/tests/integration/filesystem_blueprint/test_model.py @@ -55,7 +55,7 @@ def test_init(self) -> None: def test_from_path__missing_file(self) -> None: name = "foo" path = Path("/path/to/workspaces/internal_studies") - dto = asyncio.run(MountPointDTO.from_path(name, path)) + dto = MountPointDTO.from_path(name, path) assert dto.name == name assert dto.path == path assert dto.total_bytes == 0 @@ -65,7 +65,7 @@ def test_from_path__missing_file(self) -> None: def test_from_path__file(self, tmp_path: Path) -> None: name = "foo" - dto = asyncio.run(MountPointDTO.from_path(name, tmp_path)) + dto = MountPointDTO.from_path(name, tmp_path) total_bytes, used_bytes, free_bytes = shutil.disk_usage(tmp_path) assert dto.name == name assert dto.path == tmp_path