When batch timeout fires, remaining tasks are cancelled.
()
| 530 | |
| 531 | @pytest.mark.asyncio |
| 532 | async 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 |
nothing calls this directly
no test coverage detected