modelcontextprotocol / modelcontextprotocol/python-sdk

tests/client/test_client.py: 14 failures on Windows — AttributeError: '...Result' object has no attribute '_meta'

Abierto
#3,544 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
Python
Estrellas
24.3k
Forks
4k
Merge medio
1 d 1 h
PR fusionados (30 d)
31

Descripción

Initial Checks
Release line

2.x (current stable)

Description

On a clean checkout of main, tests/client/test_client.py fails with 14 errors of the form AttributeError: 'CallToolResult' object has no attribute '_meta'. Did you mean: 'meta'?

The snapshots pass the wire name (snapshot(CallToolResult(_meta={...}))), but inline_snapshot's generic_call_adapter.argument() does a plain getattr(value, '_meta') and the pydantic model exposes the field as meta. The data is there — the repr shows meta={'io.modelcontextprotocol/serverInfo': ...}.

I'd expect the test suite to pass on a fresh clone with locked dependencies.

Ruled out: unlocked dependency resolution (reproduced with --frozen and --no-sync), Python version (3.12.14 and 3.14.2 both fail), and a non-ASCII checkout path (reproduces under a plain ASCII path too).

I only have Windows to test on, so I don't know whether this reproduces on Linux or macOS. If CI is green, the difference is presumably platform-specific and I'm happy to run whatever would help narrow it down.

┃ File ┃ Function ┃ Function Line ┃ Error Line ┃ Error ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
│ tests\client\test_client.py │ test_client_with_simple_server │ 133 │ │ │
│ tests\client\test_client.py │ test_client_list_tools │ 151 │ │ │
│ tests\client\test_client.py │ test_client_call_tool │ 179 │ │ │
│ tests\client\test_client.py │ test_read_resource │ 191 │ │ │
│ tests\client\test_client.py │ test_get_prompt │ 272 │ │ │
│ tests\client\test_client.py │ test_client_list_resources_wi… │ 339 │ │ │
│ tests\client\test_client.py │ test_client_list_resource_tem… │ 358 │ │ │
│ tests\client\test_client.py │ test_list_prompts │ 369 │ │ │
│ tests\client\test_client.py │ test_complete_with_prompt_ref… │ 387 │ │ │
│ tests\client\test_client.py │ test_call_tool_auto_loop_disp… │ 768 │ 797 │ AttributeError │
│ tests\client\test_client.py │ test_call_tool_auto_loop_disp… │ 810 │ 846 │ AttributeError │
│ tests\client\test_client.py │ test_call_tool_auto_loop_disp… │ 857 │ 881 │ AttributeError │
│ tests\client\test_client.py │ test_get_prompt_auto_loop_res… │ 945 │ 968 │ AttributeError │
│ tests\client\test_client.py │ test_read_resource_auto_loop_… │ 976 │ 999 │ AttributeError

Example Code
┃  File                         ┃  Function                        ┃  Function Line  ┃  Error Line  ┃  Error           ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
│  tests\client\test_client.py  │  test_client_with_simple_server  │  133            │              │                  │
│  tests\client\test_client.py  │  test_client_list_tools          │  151            │              │                  │
│  tests\client\test_client.py  │  test_client_call_tool           │  179            │              │                  │
│  tests\client\test_client.py  │  test_read_resource              │  191            │              │                  │
│  tests\client\test_client.py  │  test_get_prompt                 │  272            │              │                  │
│  tests\client\test_client.py  │  test_client_list_resources_wi…  │  339            │              │                  │
│  tests\client\test_client.py  │  test_client_list_resource_tem…  │  358            │              │                  │
│  tests\client\test_client.py  │  test_list_prompts               │  369            │              │                  │
│  tests\client\test_client.py  │  test_complete_with_prompt_ref…  │  387            │              │                  │
│  tests\client\test_client.py  │  test_call_tool_auto_loop_disp…  │  768            │  797         │  AttributeError  │
│  tests\client\test_client.py  │  test_call_tool_auto_loop_disp…  │  810            │  846         │  AttributeError  │
│  tests\client\test_client.py  │  test_call_tool_auto_loop_disp…  │  857            │  881         │  AttributeError  │
│  tests\client\test_client.py  │  test_get_prompt_auto_loop_res…  │  945            │  968         │  AttributeError  │
│  tests\client\test_client.py  │  test_read_resource_auto_loop_…  │  976            │  999         │  AttributeError

git clone https://github.com/modelcontextprotocol/python-sdk.git
cd python-sdk
uv sync --frozen --all-extras --dev
uv run --no-sync pytest tests/client/test_client.py -q

# → 14 failed, 33 passed
Python & MCP Python SDK
Python 3.12.14 (also reproduced on 3.14.2)
mcp 2.2.1.dev1+6affe5c0 (source checkout of main, commit 6affe5c0)
inline_snapshot 0.28.0, pydantic 2.12.5 (both from uv.lock)
uv 0.12.16
Windows 11, PowerShell

Guía de contribución

Abrir la guía de contribución

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.

Línea de trabajo

Empieza ejecutando uv run --no-sync pytest tests/client/test_client.py -q en Windows con las dependencias fijadas. Lee los casos que fallan en tests/client/test_client.py y compara sus argumentos de snapshot de CallToolResult con el comportamiento indicado de meta/_meta. Se considera terminado cuando se hayan resuelto los 14 fallos y el archivo de pruebas del cliente pase sin debilitar sus resultados esperados.

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

Evaluación

Stack tecnológico
python
Área
testing
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Activo
Claridad
Bien especificado
Aptitud para principiantes
75/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.