Skip to content

Commit 3d1bdea

Browse files
committed
test: add pyright-safe annotations for stdio spy
Made-with: Cursor
1 parent f7abb9d commit 3d1bdea

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/server/mcpserver/test_run_stdio_custom_streams.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
from __future__ import annotations
44

55
import io
6+
from collections.abc import AsyncIterator
67
from contextlib import asynccontextmanager
8+
from typing import Any
79
from unittest.mock import AsyncMock
810

911
import anyio
@@ -17,14 +19,17 @@ async def test_run_stdio_async_passes_streams_to_stdio_server(monkeypatch: pytes
1719
captured: dict[str, object] = {}
1820

1921
@asynccontextmanager
20-
async def spy_stdio_server(stdin=None, stdout=None):
22+
async def spy_stdio_server(
23+
stdin: anyio.AsyncFile[str] | None = None,
24+
stdout: anyio.AsyncFile[str] | None = None,
25+
) -> AsyncIterator[tuple[AsyncMock, AsyncMock]]:
2126
captured["stdin"] = stdin
2227
captured["stdout"] = stdout
2328
read_stream = AsyncMock()
2429
write_stream = AsyncMock()
2530
yield read_stream, write_stream
2631

27-
async def noop_run(*_args, **_kwargs):
32+
async def noop_run(*_args: Any, **_kwargs: Any) -> None:
2833
return None
2934

3035
monkeypatch.setattr("mcp.server.mcpserver.server.stdio_server", spy_stdio_server)

0 commit comments

Comments
 (0)