Skip to content

fix(tests): skip symlink test gracefully when creation is unavailable on Windows#653

Open
iamadhitya1 wants to merge 1 commit into
usestrix:mainfrom
iamadhitya1:fix/winerror-1314-symlink
Open

fix(tests): skip symlink test gracefully when creation is unavailable on Windows#653
iamadhitya1 wants to merge 1 commit into
usestrix:mainfrom
iamadhitya1:fix/winerror-1314-symlink

Conversation

@iamadhitya1

Copy link
Copy Markdown

Problem

test_directory_size_skips_symlinks in tests/test_local_sources.py crashes on Windows for standard users (non-Administrator, Developer Mode off) because Path.symlink_to() raises OSError: [WinError 1314] A required privilege is not held by the client.

Fixes #650

Fix

Wrap the symlink creation in a try/except OSError and call pytest.skip() if it fails. This is better than a blanket skipif(sys.platform == "win32") because the test still runs on Windows when symlinks are available (Developer Mode enabled or running as Administrator), and skips cleanly only when they are not.

Changes

tests/test_local_sources.py: 5-line change — wrap symlink_to() in try/except, skip with an explanatory message on failure.

Before / After

Before: test crashes with OSError: [WinError 1314] on Windows standard users, blocking the entire test suite.

After: test skips with "symlink creation unavailable; on Windows run as Administrator or enable Developer Mode" and the suite continues.

… 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 usestrix#650
@greptile-apps

greptile-apps Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes the symlink size test skip cleanly when symlink creation is unavailable. The main changes are:

  • Wraps Path.symlink_to() in a runtime OSError check.
  • Skips the test with an explanatory message when the fixture cannot be created.
  • Keeps the existing size assertion unchanged when symlink creation succeeds.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.
  • The assertion still runs when symlink creation succeeds.
  • The skipped path only applies when the test cannot create the symlink fixture.

Important Files Changed

Filename Overview
tests/test_local_sources.py Updates one symlink-related test to skip when the test fixture cannot be created.

Reviews (1): Last reviewed commit: "fix(tests): skip symlink test gracefully..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] WinError 1314 when creating symbolic links on Windows without Administrator privileges

1 participant