From 3a0283704168840a4dea0c11a2d9c22001fbdd2d Mon Sep 17 00:00:00 2001 From: lei_lei <96427312+leilei3167@users.noreply.github.com> Date: Wed, 9 Sep 2026 03:08:50 +0000 Subject: [PATCH] test(streaming): satisfy PT012 for async EOF MidStreamFallbackError --- .../litellm_core_utils/test_streaming_handler.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_litellm/litellm_core_utils/test_streaming_handler.py b/tests/test_litellm/litellm_core_utils/test_streaming_handler.py index 18b61a82ea6..0a96d2d466b 100644 --- a/tests/test_litellm/litellm_core_utils/test_streaming_handler.py +++ b/tests/test_litellm/litellm_core_utils/test_streaming_handler.py @@ -4915,10 +4915,14 @@ async def test_clean_eof_without_finish_reason_raises_midstream_error_issue_4026 ) chunks = [] - with pytest.raises(MidStreamFallbackError) as excinfo: + + async def _consume(): async for c in wrapper: chunks.append(c) + with pytest.raises(MidStreamFallbackError) as excinfo: + await _consume() + assert chunks, "partial content should have been yielded before the error" assert all(getattr(c.choices[0], "finish_reason", None) is None for c in chunks) assert wrapper.received_finish_reason is None