Repository navigation
test(core): skip prompt-loading symlink tests when symlinks are unavailable - #40405
Vijay Biradar (iam-kira) wants to merge 1 commit into
Conversation
…ilable
Three tests in tests/unit_tests/prompts/test_loading.py create symlinks with no
guard, so they fail on Windows for any user who is not elevated and does not have
Developer Mode enabled:
OSError: [WinError 1314] A required privilege is not held by the client
FAILED test_symlink_txt_to_py_is_blocked
FAILED test_symlink_jinja2_rce_is_blocked
FAILED test_save_symlink_to_py_is_blocked
No workflow runs the suite on Windows, so nothing upstream could have caught it.
This reuses the guard already used for the same problem in
libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_file_search.py,
where five symlink-based security tests skip the same way. These are unit tests
on tmp_path, so the only realistic failure is the platform being unable to create
a symlink at all -- which is exactly what the skip is for.
Where symlinks work, behaviour is unchanged.
test_loading.py on Windows: 3 failed / 23 passed -> 0 failed / 23 passed, 3 skipped.
Merging this PR will not alter performance
Comparing Footnotes
|
Ayush Tiwari (Ayushdevo)
left a comment
There was a problem hiding this comment.
Reviewed head fdb9709 independently.
I ran the complete prompt-loading test module on Linux/Python 3.12.14 with sockets disabled: 26 passed. The new try/except covers only symlink creation, so successful creation still reaches the existing extension-resolution and Jinja2 rejection assertions; those security checks are not swallowed by the skip. This preserves the useful Linux coverage while permitting environments without symlink privileges to skip the setup-dependent cases. I have not exercised Windows privilege handling, so the cross-platform part remains a CI validation item rather than a claimed result. No blocking finding in this test-only diff. AI-assisted review.
Fixes #40241
Three prompt-loading security tests in
libs/corecreated symlinks with no guard, so anyone running the core suite on non-elevated Windows got 3 failures (WinError 1314) before touching any code. This skips them there using the same guardtest_file_search.pyalready uses; nothing changes wherever symlinks work.How did you verify your code works?
On Windows 11, non-elevated, Developer Mode off:
test_loading.pywent from 3 failed / 23 passed to 23 passed / 3 skipped.ruff checkandruff format --checkpass. Rebased on current master (67ee6cb).