From d433450ba5dc763d68fc8026b51aa31217f34006 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Thu, 29 Oct 2026 22:08:31 -0700 Subject: [PATCH] test(mcp): wait on the loop with a hang guard instead of a 300 ms deadline --- tests/unit/responses/mcp/test_chat_completions_handler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/responses/mcp/test_chat_completions_handler.py b/tests/unit/responses/mcp/test_chat_completions_handler.py index 10ed42063a0..4529ab815d3 100644 --- a/tests/unit/responses/mcp/test_chat_completions_handler.py +++ b/tests/unit/responses/mcp/test_chat_completions_handler.py @@ -2409,7 +2409,7 @@ async def test_stream_auto_execute_routed_through_the_proxy_bills_the_partial_an _assert_one_row_bills_round_one_and_the_partial_answer(recorder, respx_mock) -_PARTIAL_COUNT_BLOCKS_SECONDS: Final = 0.3 +_LONGEST_WAIT_FOR_THE_LOOP_TO_MOVE_SECONDS: Final = 10 class _CountsTheToolResultWhileTheLoopRuns: @@ -2423,7 +2423,7 @@ class _CountsTheToolResultWhileTheLoopRuns: def __call__(self, model: str | None = None, messages: list[object] | None = None, **kwargs: object) -> int: if any(isinstance(message, Mapping) and message.get("role") == "tool" for message in messages or ()): self._loop.call_soon_threadsafe(self._counting.set) - moved: Final = self._loop_moved.wait(timeout=_PARTIAL_COUNT_BLOCKS_SECONDS) + moved: Final = self._loop_moved.wait(timeout=_LONGEST_WAIT_FOR_THE_LOOP_TO_MOVE_SECONDS) self.loop_moved_while_counting = (*self.loop_moved_while_counting, moved) return self._count(model=model, messages=messages, **kwargs)