test: drop the streaming iterator enqueue test, now covered upstream

_handle_streaming_logging already enqueues the end-of-stream logging
coroutine on GLOBAL_LOGGING_WORKER on main, so the assertion no longer
belongs to this change. What remains here is the standard_logging_object
fallback in litellm_logging.py, which main still does not handle: the
build can return None (exceptions are swallowed inside
get_standard_logging_object_payload) and loggers gated on that key drop
the request while spend tracking still succeeds.
This commit is contained in:
Rodrigo-Palma 2026-09-25 12:19:08 -03:00
parent 4d2713e8b0
commit d2be9c3374

View file

@ -1,37 +0,0 @@
"""
Regression test for https://github.com/BerriAI/litellm/issues/32019.
End-of-stream logging for /v1/messages must be enqueued on the logging
worker instead of a bare ``asyncio.create_task``: an unreferenced task can
be garbage-collected before it runs, dropping the success log entirely
(same class of bug fixed for pass-through routes in #31485).
"""
from unittest.mock import MagicMock
import pytest
from litellm.litellm_core_utils.logging_worker import GLOBAL_LOGGING_WORKER
from litellm.llms.anthropic.experimental_pass_through.messages.streaming_iterator import (
BaseAnthropicMessagesStreamingIterator,
)
@pytest.mark.asyncio
async def test_handle_streaming_logging_enqueues_on_logging_worker(monkeypatch):
enqueued = []
def fake_enqueue(async_coroutine):
enqueued.append(async_coroutine)
async_coroutine.close()
monkeypatch.setattr(GLOBAL_LOGGING_WORKER, "ensure_initialized_and_enqueue", fake_enqueue)
iterator = BaseAnthropicMessagesStreamingIterator(
litellm_logging_obj=MagicMock(),
request_body={"model": "claude-3-5-sonnet-20240620", "stream": True},
)
await iterator._handle_streaming_logging(collected_chunks=[b"data: {}\n\n"])
assert len(enqueued) == 1