Skip to content

test(windows): skip symlink security tests when symlinks unavailable - #616

Open
Adkr1989 wants to merge 1 commit into
Panniantong:mainfrom
Adkr1989:test/windows-symlink-skip
Open

test(windows): skip symlink security tests when symlinks unavailable#616
Adkr1989 wants to merge 1 commit into
Panniantong:mainfrom
Adkr1989:test/windows-symlink-skip

Conversation

@Adkr1989

Copy link
Copy Markdown

Problem

Four symlink-refusal security tests fail on stock Windows with
OSError: [WinError 1314] — creating symlinks there requires admin rights or
Developer Mode, so pytest tests/ is red out of the box on a default Windows
setup (verified on Windows 11, Python 3.11):

  • test_channels.py::TestXiaoHongShuChannel::test_saved_cli_cookie_refuses_ancestor_symlink
  • test_channels.py::TestGitHubChannel::test_hosts_metadata_refuses_ancestor_symlink
  • test_reddit_channel.py::test_check_rdt_refuses_symlink_credential
  • test_reddit_channel.py::test_check_rdt_refuses_ancestor_symlink

Fix

Wrap the symlink_to setup calls in the try/except-skip guard this suite
already uses in tests/test_private_file_writes.py ("symlinks are not
supported on this platform"). A blanket skipif(win32) was deliberately NOT
used: on Windows with Developer Mode enabled the tests can and should still run.

No behavior under test changes; only test setup gains the same capability
guard as its sibling file. After this change the full suite is green on stock
Windows: 554 passed, 32 skipped, 0 failed.

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