From 2cdcd9dafa1cf78399aa288d0aaede3c8df2a230 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 6 Nov 2026 02:53:01 +0000 Subject: [PATCH] test(proxy): type the parameters of the per-chunk overhead tests Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- tests/unit/proxy/test_common_request_processing.py | 12 ++++++------ .../proxy/test_proxy_server_endpoints_and_startup.py | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/unit/proxy/test_common_request_processing.py b/tests/unit/proxy/test_common_request_processing.py index 0f6243ab554..49bb071da6f 100644 --- a/tests/unit/proxy/test_common_request_processing.py +++ b/tests/unit/proxy/test_common_request_processing.py @@ -5202,9 +5202,7 @@ class TestHandleLLMApiExceptionProviderOverload: assert proxy_exc.type == "internal_server_error" assert proxy_exc.to_dict()["code"] == "500" - async def test_openai_route_answers_wrapped_provider_overload_as_503( - self, monkeypatch: pytest.MonkeyPatch - ) -> None: + async def test_openai_route_answers_wrapped_provider_overload_as_503(self, monkeypatch: pytest.MonkeyPatch) -> None: original: Final = InternalServerError( message="Overloaded", llm_provider="anthropic", @@ -5436,12 +5434,14 @@ class TestAsyncStreamingDataGeneratorFastPath: ProxyLogging._callback_capabilities_cache.clear() @pytest.mark.asyncio - async def test_slow_path_records_per_chunk_work_on_the_logging_object(self, monkeypatch): + async def test_slow_path_records_per_chunk_work_on_the_logging_object(self, monkeypatch: pytest.MonkeyPatch): """The overhead header is stamped before any chunk is read, so the time the proxy spends in the per-chunk hook has to be recorded on the logging object for the success callback to add.""" class _StreamingCb(CustomLogger): - async def async_post_call_streaming_hook(self, user_api_key_dict, response): + async def async_post_call_streaming_hook( + self, user_api_key_dict: UserAPIKeyAuth, response: object + ) -> object: return response monkeypatch.setattr(litellm, "callbacks", [_StreamingCb()]) @@ -5449,7 +5449,7 @@ class TestAsyncStreamingDataGeneratorFastPath: proxy_logging_obj = ProxyLogging(user_api_key_cache=MagicMock()) - async def slow_hook(**kw): + async def slow_hook(**kw: object) -> object: await asyncio.sleep(0.02) return kw["response"] diff --git a/tests/unit/proxy/test_proxy_server_endpoints_and_startup.py b/tests/unit/proxy/test_proxy_server_endpoints_and_startup.py index 07f35eac765..04d0aa98f94 100644 --- a/tests/unit/proxy/test_proxy_server_endpoints_and_startup.py +++ b/tests/unit/proxy/test_proxy_server_endpoints_and_startup.py @@ -11,7 +11,7 @@ import subprocess import sys import time import types -from collections.abc import Callable, Iterator, Mapping, Sequence +from collections.abc import AsyncIterator, Callable, Iterator, Mapping, Sequence from datetime import datetime, timedelta, timezone from pathlib import Path from types import MappingProxyType @@ -7582,11 +7582,11 @@ async def test_async_data_generator_records_per_chunk_work_on_the_logging_object mock_proxy_logging_obj = MagicMock(spec=ProxyLogging) - async def mock_streaming_iterator(*args, **kwargs): + async def mock_streaming_iterator(*args: object, **kwargs: object) -> AsyncIterator[object]: for chunk in mock_chunks: yield chunk - async def slow_hook(**kwargs): + async def slow_hook(**kwargs: object) -> object: await asyncio.sleep(0.02) return kwargs.get("response")