MCPcopy Create free account
hub / github.com/IBM/mcp-cli / test_stream_batch_timeout_cancels_remaining

Function test_stream_batch_timeout_cancels_remaining

tests/tools/test_execution.py:601–616  ·  view source on GitHub ↗

Streaming: when batch timeout fires, remaining tasks are cancelled.

()

Source from the content-addressed store, hash-verified

599
600@pytest.mark.asyncio
601async def test_stream_batch_timeout_cancels_remaining():
602 """Streaming: when batch timeout fires, remaining tasks are cancelled."""
603 manager = SlowMockToolManager(delays={"fast_tool": 0.01, "slow_tool": 10.0})
604 calls = [
605 CTPToolCall(id="call_1", tool="fast_tool", arguments={}),
606 CTPToolCall(id="call_2", tool="slow_tool", arguments={}),
607 ]
608
609 results = []
610 async for result in stream_execute_tools(manager, calls, batch_timeout=0.5):
611 results.append(result)
612
613 # fast_tool should have been yielded; slow_tool should have been cancelled
614 completed_tools = {r.tool for r in results}
615 assert "fast_tool" in completed_tools
616 assert "slow_tool" not in completed_tools
617
618
619@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 2

stream_execute_toolsFunction · 0.90
SlowMockToolManagerClass · 0.85

Tested by

no test coverage detected