Skip to content

Commit 5ef8194

Browse files
test: bound initialize() with anyio.fail_after to fail fast on regression
1 parent b5ddbf4 commit 5ef8194

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tests/client/test_notification_response.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import json
88

9+
import anyio
910
import httpx2
1011
import mcp_types as types
1112
import pytest
@@ -143,7 +144,8 @@ async def test_initialize_does_not_hang_on_unexpected_content_type() -> None:
143144
async with streamable_http_client("http://localhost/mcp", http_client=client) as (read_stream, write_stream):
144145
async with ClientSession(read_stream, write_stream) as session: # pragma: no branch
145146
with pytest.raises(MCPError, match="Unexpected content type: text/plain"): # pragma: no branch
146-
await session.initialize()
147+
with anyio.fail_after(5):
148+
await session.initialize()
147149

148150

149151
def _create_http_error_app(error_status: int, *, error_on_notifications: bool = False) -> Starlette:

0 commit comments

Comments
 (0)