mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-28 10:18:08 +02:00
fix: shield lifespan teardown from cancellation (#3480)
* fix: shield lifespan teardown from cancellation Co-authored-by: Claude <noreply@anthropic.com> * fix: stabilize flaky task and timeout tests under parallel execution Co-authored-by: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
e41e1fec10
commit
24d7aefe28
6 changed files with 180 additions and 31 deletions
|
|
@ -1,7 +1,5 @@
|
|||
"""Client timeout tests."""
|
||||
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
from mcp import McpError
|
||||
|
||||
|
|
@ -36,15 +34,11 @@ class TestTimeout:
|
|||
with pytest.raises(McpError):
|
||||
await client.call_tool("sleep", {"seconds": 0.1}, timeout=0.01)
|
||||
|
||||
@pytest.mark.skipif(
|
||||
sys.platform == "win32",
|
||||
reason="This test is flaky on Windows. Sometimes the client timeout is respected and sometimes it is not.",
|
||||
)
|
||||
async def test_timeout_tool_call_overrides_client_timeout_even_if_lower(
|
||||
self, fastmcp_server: FastMCP
|
||||
):
|
||||
async with Client(
|
||||
transport=FastMCPTransport(fastmcp_server),
|
||||
timeout=0.01,
|
||||
timeout=0.1,
|
||||
) as client:
|
||||
await client.call_tool("sleep", {"seconds": 0.1}, timeout=2)
|
||||
await client.call_tool("sleep", {"seconds": 0.5}, timeout=2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue