anthropics / anthropics/anthropic-sdk-python

Three symlink tests in test_agent_toolset.py are missing the needs_symlinks marker

未關閉 適合新手
#1,915 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
3.9k
分支
853
平均合併
1 天 11 小時
30 天內合併 PR
10

描述

tests/lib/tools/test_agent_toolset.py defines a marker for exactly this situation:

needs_symlinks = pytest.mark.skipif(
sys.platform == "win32", reason="symlink fixtures need a POSIX filesystem"
)
It is applied to nine tests. Three others create symlinks without it, and fail on Windows for any user who is not elevated and does not have Developer Mode enabled:

FAILED tests/lib/tools/test_agent_toolset.py::test_grep_skips_symlinked_files
FAILED tests/lib/tools/test_agent_toolset.py::test_read_through_symlink_escape_is_rejected
FAILED tests/lib/tools/test_agent_toolset.py::test_glob_post_filters_symlink_escape
E OSError: [WinError 1314] A required privilege is not held by the client
All three carry @needs_pydantic_v2 but not @needs_symlinks.

Full file on Windows: 3 failed, 69 passed, 20 skipped. Those three are the only failures — the rest of the suite is clean, and the other symlink tests skip correctly with the existing marker.

Why CI doesn't catch it
The workflows run ubuntu-latest only; no job executes the suite on Windows. So the marker's absence has no observable effect in CI, and the failure appears only on a contributor's machine.

Worth noting the shape of it: the project clearly knows about this — the marker exists and is used nine times. Three tests were simply missed, and nothing could tell you.

Suggested fix (implemented and verified)
Add the existing marker to the three tests:

@needs_symlinks
@needs_pydantic_v2
async def test_read_through_symlink_escape_is_rejected(tmp_path: Path) -> None:
Three added lines, no new machinery. Verified on Windows: 3 failed / 69 passed → 0 failed / 69 passed, with the three now skipping for the documented reason.

Patch: patches/anthropic-sdk-python/0001-tests-mark-three-symlink-tests-with-needs_symlinks.patch

Environment
Windows-11-10.0.26200-SP0
Python 3.13.15
anthropic-sdk-python at HEAD, `uv sync` dev environment
A note on scope
If you would rather these tests ran on Windows than skipped, the alternative is a try/except OSError that skips only when the platform actually refuses — that preserves coverage on elevated machines and on any future Windows CI job. The marker approach matches what the file already does, which is why the patch takes it.

貢獻指南

開啟貢獻指南

研究方向

Open tests/lib/tools/test_agent_toolset.py and compare the three named symlink tests with the nine tests already using needs_symlinks. Run the relevant test file, ideally on Windows, and confirm the three tests skip with the documented reason while the remaining tests continue to pass.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
testing-qa
Issue 類型
缺陷
難度
1/5
預估耗時
1 小時以內
活躍度
活躍
描述清晰度
描述清楚
新手友好度
92/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。