Skip to content

test: skip contents-manager symlink tests when symlinks are unavailable - #1706

Open
iam-kira wants to merge 1 commit into
jupyter-server:mainfrom
iam-kira:test/skip-symlink-manager-tests-without-privilege
Open

iam-kira wants to merge 1 commit into
jupyter-server:mainfrom
iam-kira:test/skip-symlink-manager-tests-without-privilege

Conversation

@iam-kira

Copy link
Copy Markdown

What

tests/services/contents/test_manager.py::test_bad_symlink and ::test_good_symlink
error in setup on Windows without elevation or Developer Mode:

OSError: [WinError 1314] A required privilege is not held by the client

Both go through the module's symlink() helper, which calls os.symlink()
unconditionally. CI stays green because the windows-latest runner can create
symlinks, so the failure is invisible in CI and only hits an unprivileged Windows
contributor's local run. (test_recursive_symlink is already skipif(win), for an
unrelated reason.)

Fix

Guard the symlink() helper with pytest.skip on OSError, matching the
try/except capability check already used in test_fileio.py. The tests still run
everywhere symlinks can be created (Linux, macOS, and elevated / Developer-Mode
Windows) — only the unprivileged-Windows case is skipped instead of erroring.

Note

Verified with py_compile and by inspection; the change is a try/except that only
activates when os.symlink raises, so it can't affect the passing path. I don't have
an unprivileged-Windows CI runner to exercise the skip, so a maintainer confirming it
there would be welcome.

🤖 Generated with Claude Code

The symlink() test helper calls os.symlink unconditionally, so test_bad_symlink and test_good_symlink error in setup on Windows without elevation or Developer Mode (WinError 1314). CI stays green because the windows-latest runner can create symlinks.

Guard the helper with pytest.skip on OSError, matching the try/except capability check already used in test_fileio.py. The tests still run wherever symlinks can be created.

Co-Authored-By: Claude Opus 4.8 <[email protected]>

This branch has not been deployed

No deployments
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.

1 participant