From 9f4a1d186e6433ef48c8c7638561d8722de2d101 Mon Sep 17 00:00:00 2001 From: iamadhitya1 Date: Fri, 3 Jul 2026 21:05:27 +0530 Subject: [PATCH] fix(tests): skip symlink test gracefully when creation is unavailable on Windows On Windows, Path.symlink_to() raises OSError (WinError 1314) for standard users without Developer Mode enabled. Wrapping the symlink call in a try/except and calling pytest.skip() lets the test run when symlinks are available (Developer Mode) while skipping cleanly when they are not, instead of crashing the test suite. Fixes #650 --- tests/test_local_sources.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_local_sources.py b/tests/test_local_sources.py index bd3448de8..34fededc8 100644 --- a/tests/test_local_sources.py +++ b/tests/test_local_sources.py @@ -47,7 +47,12 @@ 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: + pytest.skip( + "symlink creation unavailable; 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