From fca9f9fdd94d292571f7c729e905127822ac0ad5 Mon Sep 17 00:00:00 2001 From: pranav-afk Date: Sat, 11 Jul 2026 18:59:46 +0530 Subject: [PATCH 1/2] fix(tests): skip symlink test when Windows lacks privilege On Windows without Administrator or Developer Mode, Path.symlink_to raises WinError 1314 and crashes the suite. Skip with a clear remediation message instead. Fixes #650. --- tests/test_local_sources.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/test_local_sources.py b/tests/test_local_sources.py index 22ed4b9bf..a40e892f3 100644 --- a/tests/test_local_sources.py +++ b/tests/test_local_sources.py @@ -48,7 +48,14 @@ def test_directory_size_sums_flat_and_nested_files(tmp_path: Path) -> None: def test_directory_size_skips_symlinks(tmp_path: Path) -> None: _write_file(tmp_path / "real.txt", 100) - (tmp_path / "link.txt").symlink_to(tmp_path / "real.txt") + try: + (tmp_path / "link.txt").symlink_to(tmp_path / "real.txt") + except OSError as exc: + # Windows without Admin / Developer Mode: WinError 1314. + pytest.skip( + f"symlink creation unavailable ({exc}); on Windows run as " + "Administrator or enable Developer Mode" + ) # The symlink target is counted once via the real file, not doubled. assert directory_size_bytes(tmp_path) == 100 From a4dc0a899a6388b47703f9b9f454acef0880bd43 Mon Sep 17 00:00:00 2001 From: pranav-afk Date: Sat, 11 Jul 2026 19:04:33 +0530 Subject: [PATCH 2/2] fix(tests): only skip symlink test on WinError 1314 Re-raise unrelated OSErrors so setup failures are not hidden as skips. --- tests/test_local_sources.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_local_sources.py b/tests/test_local_sources.py index a40e892f3..efe482233 100644 --- a/tests/test_local_sources.py +++ b/tests/test_local_sources.py @@ -52,6 +52,9 @@ def test_directory_size_skips_symlinks(tmp_path: Path) -> None: (tmp_path / "link.txt").symlink_to(tmp_path / "real.txt") except OSError as exc: # Windows without Admin / Developer Mode: WinError 1314. + # Other OSErrors (read-only FS, etc.) should still fail the test. + if getattr(exc, "winerror", None) != 1314: + raise pytest.skip( f"symlink creation unavailable ({exc}); on Windows run as " "Administrator or enable Developer Mode"