diff --git a/tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_streaming_iterator.py b/tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_streaming_iterator.py index f0a3c7fdff0..6a1b6f417a2 100644 --- a/tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_streaming_iterator.py +++ b/tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_streaming_iterator.py @@ -501,10 +501,14 @@ async def test_async_sse_wrapper_reraises_upstream_error_to_connected_client(): ) received = [] - with pytest.raises(_ProviderStreamError) as excinfo: + + async def _drain(): async for chunk in iterator.async_sse_wrapper(_failing_stream()): received.append(chunk) + with pytest.raises(_ProviderStreamError) as excinfo: + await _drain() + assert excinfo.value.status_code == 529 assert received assert not any(c.startswith(b"event: error\n") for c in received)