mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-28 10:18:08 +02:00
Remove old client test; ensure server starts on every test
This commit is contained in:
parent
f1f57f977b
commit
a1955eb5cd
1 changed files with 5 additions and 13 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import asyncio
|
||||
import json
|
||||
import sys
|
||||
from collections.abc import Generator
|
||||
from collections.abc import AsyncGenerator
|
||||
|
||||
import pytest
|
||||
import uvicorn
|
||||
|
|
@ -87,9 +87,11 @@ def run_nested_server(host: str, port: int) -> None:
|
|||
server.run()
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def streamable_http_server() -> Generator[str, None, None]:
|
||||
@pytest.fixture()
|
||||
async def streamable_http_server() -> AsyncGenerator[str, None]:
|
||||
with run_server_in_process(run_server, transport="streamable-http") as url:
|
||||
async with Client(transport=StreamableHttpTransport(f"{url}/mcp")) as client:
|
||||
assert await client.ping()
|
||||
yield f"{url}/mcp"
|
||||
|
||||
|
||||
|
|
@ -158,13 +160,3 @@ class TestTimeout:
|
|||
) as client:
|
||||
with pytest.raises(McpError):
|
||||
await client.call_tool("sleep", {"seconds": 0.2}, timeout=0.1)
|
||||
|
||||
async def test_timeout_client_timeout_overrides_tool_call_timeout_if_lower(
|
||||
self, streamable_http_server: str
|
||||
):
|
||||
with pytest.raises(McpError):
|
||||
async with Client(
|
||||
transport=StreamableHttpTransport(streamable_http_server),
|
||||
timeout=0.1,
|
||||
) as client:
|
||||
await client.call_tool("sleep", {"seconds": 0.2}, timeout=2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue