From 647a962f41a5710e4bd3c2bd6777b9aae18909b5 Mon Sep 17 00:00:00 2001 From: yyobject <48043998+yyobject@users.noreply.github.com> Date: Tue, 27 Oct 2026 13:16:11 +0800 Subject: [PATCH] test(anthropic): cover attempt-scoped interruption logging --- .../proxy/pass_through_endpoints/test_streaming_handler.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/unit/proxy/pass_through_endpoints/test_streaming_handler.py b/tests/unit/proxy/pass_through_endpoints/test_streaming_handler.py index d943b3cc433..bee4fec4771 100644 --- a/tests/unit/proxy/pass_through_endpoints/test_streaming_handler.py +++ b/tests/unit/proxy/pass_through_endpoints/test_streaming_handler.py @@ -182,6 +182,9 @@ async def test_interrupted_anthropic_stream_recovers_output_tokens_off_the_event logging_obj.get_router_model_id.return_value = None logging_obj.dispatch_success_handlers = AsyncMock() logging_obj.dispatch_failure_handlers = AsyncMock() + logging_obj.dispatch_attempt_failure_handlers = AsyncMock( + side_effect=logging_obj.dispatch_failure_handlers + ) _, took, lags = await timed_with_loop_lags( lambda: PassThroughStreamingHandler._route_streaming_logging_to_handler( @@ -198,6 +201,7 @@ async def test_interrupted_anthropic_stream_recovers_output_tokens_off_the_event ) logging_obj.dispatch_success_handlers.assert_not_awaited() + logging_obj.dispatch_attempt_failure_handlers.assert_awaited_once() logging_obj.dispatch_failure_handlers.assert_awaited_once() logged_usage = logging_obj.record_partial_usage_for_failure.call_args.kwargs["usage"] assert logged_usage.completion_tokens > 100_000