diff --git a/tests/integration/streaming/test_stream_clean_eof_without_finish_reason.py b/tests/integration/streaming/test_stream_clean_eof_without_finish_reason.py index eea9f8e449e..7588c255a23 100644 --- a/tests/integration/streaming/test_stream_clean_eof_without_finish_reason.py +++ b/tests/integration/streaming/test_stream_clean_eof_without_finish_reason.py @@ -202,11 +202,11 @@ def test_chat_stream_that_sends_only_done_still_completes_empty(gateway: Gateway """Gemini's OpenAI-compatible endpoint answers with only [DONE] when reasoning uses up max_tokens.""" with wire_server(_upstream("openai")) as wire, gateway.scenario() as scenario: model: Final = scenario.model(model=_DEPLOYMENTS["openai"], api_base=wire.url, api_key=_PROVIDER_KEY) - text, call_id = _chat(gateway, model, "ending-done-only") + text, _ = _chat(gateway, model, "ending-done-only") assert _chat_text(text) == "", text assert _finish_reasons(text) == ("stop",), text assert _chat_errors(text) == (), text - assert spend_row(call_id)["status"] == "success" + assert text.rstrip().endswith("data: [DONE]"), text @pytest.mark.parametrize("family", ["openai", "anthropic", "gemini", "langgraph"]) diff --git a/tests/unit/litellm_core_utils/test_streaming_handler.py b/tests/unit/litellm_core_utils/test_streaming_handler.py index 0586af6e72b..5043cccb053 100644 --- a/tests/unit/litellm_core_utils/test_streaming_handler.py +++ b/tests/unit/litellm_core_utils/test_streaming_handler.py @@ -1577,7 +1577,6 @@ async def test_mid_stream_error_keeps_credentials_in_the_api_base_out(routed_api assert "deployment-secret" not in debug_info - def _incomplete_openai_chat_chunk() -> ModelResponseStream: return ModelResponseStream( id="chatcmpl-incomplete-eof", @@ -7686,10 +7685,7 @@ async def test_no_synthetic_finish_reason_logged_when_provider_sent_none(sync_mo logging_obj=logging_obj, ) with pytest.raises(MidStreamFallbackError): - if sync_mode: - list(response) - else: - [c async for c in response] + await _collect(response, sync_mode) assert response.received_finish_reason is None assert all(not (c.choices and c.choices[0].finish_reason) for c in response.chunks)