anthropics / anthropics/anthropic-sdk-python
Three symlink tests in test_agent_toolset.py are missing the needs_symlinks marker
- Langage dominant
- Python
- Étoiles
- 3.9k
- Forks
- 853
- Merge moyen
- 1 j 11 h
- PR mergées (30 j)
- 10
Description
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.
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- testing-qa
- Type d'issue
- Bug
- Difficulté
- 1/5
- Temps estimé
- Moins d'une heure
- Activité
- Active
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 92/100