diff --git a/tests/owilix/core/tasks/test_remote.py b/tests/owilix/core/tasks/test_remote.py index 5f3d98c..9ef8df7 100644 --- a/tests/owilix/core/tasks/test_remote.py +++ b/tests/owilix/core/tasks/test_remote.py @@ -8,6 +8,7 @@ import json import os import tempfile from collections import Counter +from pathlib import Path from types import SimpleNamespace from unittest.mock import MagicMock, patch, PropertyMock @@ -780,12 +781,22 @@ class TestRemotePull: ds = _make_mock_dataset() manager = _make_mock_manager(datasets=[ds]) manager.remote_data.files.return_value = [] + # remote_pull writes sync sidecars under the *local* dataset path + # (_write_pull_sidecars -> core/sync.py). Left as a bare MagicMock, that + # path resolves through __fspath__ to a repr-derived relative path and + # the run mkdirs `MagicMock/mock.local.create().path//` into the + # current working directory -- i.e. into the repo. Point it at tmp_path. + local_target = tmp_path / "pulled-dataset" + local_target.mkdir() + manager.local.create.return_value.path = str(local_target) result = remote_pull( manager, specifier="dc1/public", files="['**/*']", console=MagicMock() ) assert result.success is True + # The sidecars belong to the dataset, not to wherever the process ran. + assert not (Path.cwd() / "MagicMock").exists() @patch("owilix.core.tasks.remote.ask_yes_no", return_value=False) def test_user_declines(self, mock_ask):