fix(tests): path traversal test suite errors on Windows without symlink privilege - #230
Merged
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…nk privilege All 26 tests in test_path_traversal.py depend on a shared project_tree fixture that unconditionally calls symlink_to() twice. Creating symlinks on Windows requires SeCreateSymbolicLinkPrivilege (Administrator or Developer Mode) — without it, os.symlink() raises OSError WinError 1314, and since the fixture setup fails, EVERY dependent test errors, including tests that don't test symlink behavior at all (e.g. test_raises_for_empty_path). Fix: wrap symlink creation in try/except OSError, falling back to a plain file so non-symlink-specific tests still run. The fixture exposes symlinks_supported so the ~8 tests that specifically test symlink-escape behavior can skip themselves individually when the platform lacks the privilege, rather than showing a spurious collection error. Before: 26 errors (entire file uncollectable in restricted environments). After: 33 passed, 8 skipped (symlink-specific tests skip cleanly, correctly sourced from Known Gap: this environment lacks symlink privilege — not a CodeLens bug).
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Found during a full test suite health check —
test_path_traversal.pyproduced 26 collection ERRORs (not failures), all from the sharedproject_treefixture unconditionally callingsymlink_to(), which requires elevated privilege on Windows (SeCreateSymbolicLinkPrivilege) and raisesOSError WinError 1314without it.Since every test in the file depends on this fixture, ALL 26 errored — including tests unrelated to symlinks (e.g.
test_raises_for_empty_path).Fix: wrap symlink creation in try/except, fall back to a plain file. The ~8 tests that specifically test symlink-escape behavior check
symlinks_supportedand skip themselves cleanly when the platform lacks the privilege.Before: 26 errors. After: 33 passed, 8 skipped.