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

Function test_batch_timeout_cancels_remaining

tests/tools/test_execution.py:532–548  ·  view source on GitHub ↗

When batch timeout fires, remaining tasks are cancelled.

()

Source from the content-addressed store, hash-verified

530
531@pytest.mark.asyncio
532async def test_batch_timeout_cancels_remaining():
533 """When batch timeout fires, remaining tasks are cancelled."""
534 # fast_tool completes quickly, slow_tool takes much longer than the batch timeout
535 manager = SlowMockToolManager(delays={"fast_tool": 0.01, "slow_tool": 10.0})
536 calls = [
537 CTPToolCall(id="call_1", tool="fast_tool", arguments={}),
538 CTPToolCall(id="call_2", tool="slow_tool", arguments={}),
539 ]
540
541 results = await execute_tools_parallel(manager, calls, batch_timeout=0.5)
542
543 # fast_tool should have completed; slow_tool should have been cancelled
544 completed_tools = {r.tool for r in results}
545 assert "fast_tool" in completed_tools
546 # slow_tool should NOT have completed (it sleeps for 10s, batch timeout is 0.5s)
547 assert "slow_tool" not in completed_tools
548 assert len(results) < len(calls)
549
550
551@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 2

execute_tools_parallelFunction · 0.90
SlowMockToolManagerClass · 0.85

Tested by

no test coverage detected