Repository navigation
Description
Labels: bug, tests, windows
Version: 0.9.40
Environment: Windows 11, non-elevated shell, Developer Mode off
Summary
Creating a symlink on Windows requires either an elevated process or Developer Mode. Fifteen
tests call Path.symlink_to() / os.symlink() unguarded, so on a default Windows developer
machine they raise OSError: [WinError 1314] A required privilege is not held by the client
and are reported as failures rather than skips.
This is the single largest block of noise in the suite — 15 of 42 failures on a clean
checkout — which makes the run unusable as a signal on Windows.
Steps to reproduce
$ pytest tests/ -q
...
42 failed, 4120 passed, 16 skipped
$ pytest tests/ -q --tb=line 2>&1 | grep -c "WinError 1314"
30
Affected tests
tests/test_detect.py::test_detect_follows_symlinked_directory
tests/test_detect.py::test_detect_follows_symlinked_file
tests/test_detect.py::test_detect_handles_circular_symlinks
tests/test_detect.py::test_detect_default_does_not_auto_follow_direct_symlink_child
tests/test_detect.py::test_detect_explicit_false_overrides_auto_detect
tests/test_detect.py::test_detect_skips_out_of_root_symlinked_directory_even_when_following
tests/test_detect.py::test_detect_skips_out_of_root_symlinked_file_by_default
tests/test_detect.py::test_detect_incremental_propagates_follow_symlinks
tests/test_extract.py::test_collect_files_follows_symlinked_directory
tests/test_extract.py::test_collect_files_skips_out_of_root_symlinked_directory
tests/test_extract.py::test_collect_files_skips_out_of_root_symlinked_file_by_default
tests/test_extract.py::test_collect_files_handles_circular_symlinks
tests/test_atomic_writes.py::test_write_text_atomic_writes_through_symlink
tests/test_image_vision.py::test_read_files_skips_out_of_root_symlink
tests/test_image_vision.py::test_build_image_refs_skips_out_of_root_symlink
Representative traceback:
def test_write_text_atomic_writes_through_symlink(tmp_path):
target = tmp_path / "real.json"
target.write_text("old", encoding="utf-8")
link = tmp_path / "link.json"
> link.symlink_to(target)
E OSError: [WinError 1314] A required privilege is not held by the client
Expected behavior
Skipped with a clear reason on a machine that cannot create symlinks, so the failure count
reflects real defects.
Suggested fix
Add a capability-probing fixture to tests/conftest.py — probe rather than check
sys.platform, since an elevated shell or Developer Mode can create symlinks on Windows
and those runs should still get the coverage:
import os, tempfile, pathlib, pytest
@pytest.fixture(scope="session")
def _can_symlink() -> bool:
with tempfile.TemporaryDirectory() as d:
src = pathlib.Path(d) / "src"
src.write_text("x")
try:
(pathlib.Path(d) / "lnk").symlink_to(src)
return True
except (OSError, NotImplementedError):
return False
@pytest.fixture
def requires_symlinks(_can_symlink):
if not _can_symlink:
pytest.skip("symlink creation unavailable "
"(Windows needs elevation or Developer Mode)")then take requires_symlinks as a parameter in the 15 tests above.
Note
This is test infrastructure only — I found no evidence the symlink handling code is broken.
Issue #2478 tracks a genuine product defect in that area (junction/symlink scan roots); this
report is strictly about the tests not being skippable.
Activity
test: probe-and-skip symlink tests where symlink creation is unavaila…
safishamsi commentedon Aug 13, 2026
Fixed in v0.9.42 (
graphifyy==0.9.42on PyPI). Symlink tests now probe real symlink capability and skip (rather than error) where creation is unavailable. Thanks @rajarshidattapy (PR #2648).