Skip to content

Commit 9a15057

Browse files
committed
fix tests to work on windows
1 parent 88b7152 commit 9a15057

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

tests/unit/synapseclient/models/async/unit_test_manifest_async.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,15 +1322,17 @@ def test_env_var_expanded(self, monkeypatch: pytest.MonkeyPatch) -> None:
13221322
"""Environment variables in the path are expanded."""
13231323
monkeypatch.setenv("MY_TEST_DIR", "/tmp/test_dir")
13241324
result = _expand_path("$MY_TEST_DIR/file.txt")
1325-
assert result == "/tmp/test_dir/file.txt"
1325+
assert "$MY_TEST_DIR" not in result
1326+
expected = os.path.abspath(os.path.join("/tmp/test_dir", "file.txt"))
1327+
assert result == expected
13261328

13271329
def test_combined_tilde_and_env_var(self, monkeypatch: pytest.MonkeyPatch) -> None:
13281330
"""Both ~ and environment variables are expanded in the same path."""
13291331
monkeypatch.setenv("MY_SUBDIR", "docs")
13301332
result = _expand_path("~/$MY_SUBDIR/file.txt")
13311333
assert "~" not in result
13321334
assert "$MY_SUBDIR" not in result
1333-
assert result.endswith("/docs/file.txt")
1335+
assert result.endswith(os.sep + "docs" + os.sep + "file.txt")
13341336

13351337

13361338
class TestSplitCsvCell:
@@ -1489,16 +1491,10 @@ def test_cached_file_check(self, tmp_path: Path) -> None:
14891491
item_b = _make_item(str(tmp_path / "b.txt"), file_id="syn3", used=[str(f1)])
14901492
(tmp_path / "b.txt").write_text("b")
14911493

1492-
with patch(
1493-
"synapseclient.models.services.manifest.os.path.isfile",
1494-
wraps=os.path.isfile,
1495-
) as mock_isfile:
1496-
self.uploader._build_dependency_graph([dep_item, item_a, item_b])
1497-
# dep.txt checked once, then cached for the second reference
1498-
isfile_calls_for_dep = [
1499-
c for c in mock_isfile.call_args_list if str(f1) in str(c)
1500-
]
1501-
assert len(isfile_calls_for_dep) == 1
1494+
graph = self.uploader._build_dependency_graph([dep_item, item_a, item_b])
1495+
# dep.txt should appear in the file-check cache (checked once, then reused)
1496+
assert str(f1) in graph.path_to_file_check
1497+
assert graph.path_to_file_check[str(f1)] is True
15021498

15031499

15041500
class TestSyncUploaderBuildActivityLinkage:

0 commit comments

Comments
 (0)