From ac6b7c3d4c525d8552d2ca362118773939e45a32 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Thu, 20 Aug 2026 08:36:39 -0700 Subject: [PATCH] fix unit test to use temp path instead of writing files locally --- tests/unit/synapseutils/unit_test_synapseutils_sync.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/unit/synapseutils/unit_test_synapseutils_sync.py b/tests/unit/synapseutils/unit_test_synapseutils_sync.py index f12353270..52f5a5d2f 100644 --- a/tests/unit/synapseutils/unit_test_synapseutils_sync.py +++ b/tests/unit/synapseutils/unit_test_synapseutils_sync.py @@ -7,6 +7,7 @@ import random import tempfile from io import StringIO +from pathlib import Path from typing import Any, Dict from unittest.mock import AsyncMock, MagicMock, Mock, call, create_autospec, patch @@ -885,6 +886,7 @@ def test_sync_from_synapse_manifest_is_suppress( mock_get_file_entity_provenance_dict: MagicMock, mock_generate_manifest: MagicMock, syn: Synapse, + tmp_path: Path, ) -> None: """ Verify manifest argument equal to "suppress" that pass in to syncFromSynapse, it won't create any manifest file. @@ -966,7 +968,7 @@ async def mock_get_children(*args, **kwargs): ) as patch_activity_from_parent, ): result = synapseutils.syncFromSynapse( - syn=syn, entity=project, path="./", manifest="suppress" + syn=syn, entity=project, path=str(tmp_path), manifest="suppress" ) assert [file, file_2] == result expected_get_children_agrs = [ @@ -1015,7 +1017,7 @@ async def mock_get_children(*args, **kwargs): if_collision=method_flags.COLLISION_OVERWRITE_LOCAL, limit_search=None, download_file=True, - download_location="./", + download_location=str(tmp_path), md5=None, synapse_client=syn, ), @@ -1026,7 +1028,7 @@ async def mock_get_children(*args, **kwargs): if_collision=method_flags.COLLISION_OVERWRITE_LOCAL, limit_search=None, download_file=True, - download_location=f"./{FOLDER_NAME}", + download_location=os.path.join(str(tmp_path), FOLDER_NAME), md5=None, synapse_client=syn, ),