From eabbbc41e714d372ea87dbcddbd02bdbc5ea20cd Mon Sep 17 00:00:00 2001 From: narmstrong-berry Date: Sat, 31 Oct 2026 22:46:21 +0000 Subject: [PATCH] test(router): end the scripted stream with a finish reason Since #47665 a stream that ends without a finish_reason raises MidStreamFallbackError; the core suite's scripted stream never sent one, so test_streaming_acompletion_yields_the_host_stream_chunks_with_routing_hidden_params fails on main for both cores. --- tests/unit/test_router/core/test_endpoints.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/unit/test_router/core/test_endpoints.py b/tests/unit/test_router/core/test_endpoints.py index b2ad602c4c6..c0c4c8cf6dd 100644 --- a/tests/unit/test_router/core/test_endpoints.py +++ b/tests/unit/test_router/core/test_endpoints.py @@ -414,6 +414,8 @@ def _scripted_stream(*texts: str) -> Callable[..., CustomStreamWrapper]: async def chunks() -> AsyncIterator[ModelResponseStream]: for text in texts: yield ModelResponseStream(choices=[{"index": 0, "delta": {"role": "assistant", "content": text}}]) + # A stream that ends without a finish reason fails since #47665. + yield ModelResponseStream(choices=[{"index": 0, "delta": {}, "finish_reason": "stop"}]) yield ModelResponseStream(choices=[{"index": 0, "delta": {}, "finish_reason": "stop"}]) logging_obj: Final = LiteLLMLogging(