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

Abierto Apto para principiantes
#1,915 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@okxint ya está trabajando en esto.

Desde el 7/9/2026.

  • #1917 de @okxint — abierto

Evaluación

Dificultad
1/5
Tiempo estimado
Menos de una hora
Aptitud para principiantes
92/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
testing-qa

Línea de trabajo

Abre test/lib/tools/test_agent_toolset.py y compara las tres pruebas de symlink nombradas con las nueve pruebas que ya usan needs_symlinks. Ejecuta el archivo de pruebas relevante, idealmente en Windows, y confirma que las tres pruebas se omiten con el motivo documentado, mientras las pruebas restantes siguen pasando.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
4k
Forks
905
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de anthropics/anthropic-sdk-python

Todos los issues de anthropics/anthropic-sdk-python

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.