Jeremiah Lowin commited on
Commit
0405849
·
unverified ·
2 Parent(s): 4557b32b0f3b00

Merge pull request #835 from jlowin/fix-tests

Browse files
pyproject.toml CHANGED
@@ -7,7 +7,7 @@ dependencies = [
7
  "python-dotenv>=1.1.0",
8
  "exceptiongroup>=1.2.2",
9
  "httpx>=0.28.1",
10
- "mcp>=1.9.2,<2.0.0",
11
  "openapi-pydantic>=0.5.1",
12
  "rich>=13.9.4",
13
  "typer>=0.15.2",
 
7
  "python-dotenv>=1.1.0",
8
  "exceptiongroup>=1.2.2",
9
  "httpx>=0.28.1",
10
+ "mcp>=1.9.4,<2.0.0",
11
  "openapi-pydantic>=0.5.1",
12
  "rich>=13.9.4",
13
  "typer>=0.15.2",
tests/client/test_streamable_http.py CHANGED
@@ -1,7 +1,7 @@
1
  import asyncio
2
  import json
3
  import sys
4
- from collections.abc import Generator
5
 
6
  import pytest
7
  import uvicorn
@@ -87,9 +87,11 @@ def run_nested_server(host: str, port: int) -> None:
87
  server.run()
88
 
89
 
90
- @pytest.fixture(scope="module")
91
- def streamable_http_server() -> Generator[str, None, None]:
92
  with run_server_in_process(run_server, transport="streamable-http") as url:
 
 
93
  yield f"{url}/mcp"
94
 
95
 
@@ -158,13 +160,3 @@ class TestTimeout:
158
  ) as client:
159
  with pytest.raises(McpError):
160
  await client.call_tool("sleep", {"seconds": 0.2}, timeout=0.1)
161
-
162
- async def test_timeout_client_timeout_overrides_tool_call_timeout_if_lower(
163
- self, streamable_http_server: str
164
- ):
165
- with pytest.raises(McpError):
166
- async with Client(
167
- transport=StreamableHttpTransport(streamable_http_server),
168
- timeout=0.1,
169
- ) as client:
170
- await client.call_tool("sleep", {"seconds": 0.2}, timeout=2)
 
1
  import asyncio
2
  import json
3
  import sys
4
+ from collections.abc import AsyncGenerator
5
 
6
  import pytest
7
  import uvicorn
 
87
  server.run()
88
 
89
 
90
+ @pytest.fixture()
91
+ async def streamable_http_server() -> AsyncGenerator[str, None]:
92
  with run_server_in_process(run_server, transport="streamable-http") as url:
93
+ async with Client(transport=StreamableHttpTransport(f"{url}/mcp")) as client:
94
+ assert await client.ping()
95
  yield f"{url}/mcp"
96
 
97
 
 
160
  ) as client:
161
  with pytest.raises(McpError):
162
  await client.call_tool("sleep", {"seconds": 0.2}, timeout=0.1)
 
 
 
 
 
 
 
 
 
 
uv.lock CHANGED
@@ -472,7 +472,7 @@ requires-dist = [
472
  { name = "authlib", specifier = ">=1.5.2" },
473
  { name = "exceptiongroup", specifier = ">=1.2.2" },
474
  { name = "httpx", specifier = ">=0.28.1" },
475
- { name = "mcp", specifier = ">=1.9.2,<2.0.0" },
476
  { name = "openapi-pydantic", specifier = ">=0.5.1" },
477
  { name = "python-dotenv", specifier = ">=1.1.0" },
478
  { name = "rich", specifier = ">=13.9.4" },
 
472
  { name = "authlib", specifier = ">=1.5.2" },
473
  { name = "exceptiongroup", specifier = ">=1.2.2" },
474
  { name = "httpx", specifier = ">=0.28.1" },
475
+ { name = "mcp", specifier = ">=1.9.4,<2.0.0" },
476
  { name = "openapi-pydantic", specifier = ">=0.5.1" },
477
  { name = "python-dotenv", specifier = ">=1.1.0" },
478
  { name = "rich", specifier = ">=13.9.4" },