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 3c74d73288f..3448c5e4acf 100644 --- a/tests/test_litellm/litellm_core_utils/test_streaming_handler.py +++ b/tests/test_litellm/litellm_core_utils/test_streaming_handler.py @@ -1753,4 +1753,8 @@ async def test_custom_stream_wrapper_anext_does_not_block_event_loop_for_sync_it finally: if not anext_task.done(): anext_task.cancel() + try: + await anext_task + except asyncio.CancelledError: + pass await bg_task