anthropics / anthropics/anthropic-sdk-python

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

オープン 初心者向け
#1,915 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
3.9k
フォーク
853
平均マージ
1日 11時間
マージ済み PR(30日)
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 を短くまとめたダイジェスト。