From 96eadd943e55e60ce2d49ec9f3c5dc3f3c2867da Mon Sep 17 00:00:00 2001 From: yucheng Date: Thu, 24 Sep 2026 08:08:17 +0000 Subject: [PATCH] test(http_handler): keep the cipher list tests to the changed behavior only Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../llms/custom_httpx/test_http_handler.py | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/tests/test_litellm/llms/custom_httpx/test_http_handler.py b/tests/test_litellm/llms/custom_httpx/test_http_handler.py index e131f79f2bd..b2293ed3ded 100644 --- a/tests/test_litellm/llms/custom_httpx/test_http_handler.py +++ b/tests/test_litellm/llms/custom_httpx/test_http_handler.py @@ -1,5 +1,6 @@ import asyncio import gc +import io import os import pathlib import ssl @@ -404,11 +405,9 @@ async def test_async_handler_with_shared_session(): @pytest.mark.asyncio async def test_get_async_httpx_client_with_shared_session(): """Test get_async_httpx_client with shared session""" - from litellm.llms.custom_httpx.http_handler import ( - AsyncHTTPHandler as AsyncHTTPHandlerReload, - ) from litellm.llms.custom_httpx.http_handler import ( get_async_httpx_client, + AsyncHTTPHandler as AsyncHTTPHandlerReload, ) from litellm.types.utils import LlmProviders @@ -430,11 +429,9 @@ async def test_get_async_httpx_client_with_shared_session(): @pytest.mark.asyncio async def test_get_async_httpx_client_without_shared_session(): """Test get_async_httpx_client without shared session (backward compatibility)""" - from litellm.llms.custom_httpx.http_handler import ( - AsyncHTTPHandler as AsyncHTTPHandlerReload, - ) from litellm.llms.custom_httpx.http_handler import ( get_async_httpx_client, + AsyncHTTPHandler as AsyncHTTPHandlerReload, ) from litellm.types.utils import LlmProviders @@ -471,7 +468,6 @@ async def test_session_reuse_chain(): def test_shared_session_parameter_in_acompletion(): """Test that acompletion function accepts shared_session parameter""" import inspect - from litellm.main import acompletion # Get the function signature @@ -489,7 +485,6 @@ def test_shared_session_parameter_in_acompletion(): def test_shared_session_parameter_in_completion(): """Test that completion function accepts shared_session parameter""" import inspect - from litellm.main import completion # Get the function signature @@ -507,11 +502,9 @@ def test_shared_session_parameter_in_completion(): @pytest.mark.asyncio async def test_session_reuse_integration(): """Integration test for session reuse functionality""" - from litellm.llms.custom_httpx.http_handler import ( - AsyncHTTPHandler as AsyncHTTPHandlerReload, - ) from litellm.llms.custom_httpx.http_handler import ( get_async_httpx_client, + AsyncHTTPHandler as AsyncHTTPHandlerReload, ) from litellm.types.utils import LlmProviders @@ -1485,6 +1478,7 @@ async def test_connection_error_retry_forwards_content(method: str): await handler.close() + @pytest.fixture def forward_proxy_server(): """Plain HTTP forward proxy that records the absolute URIs it is asked to fetch.""" @@ -1615,7 +1609,9 @@ def private_ca_tls_upstream(tmp_path: pathlib.Path): ca_pem.write_bytes(cert.public_bytes(serialization.Encoding.PEM)) key_pem = tmp_path / "key.pem" key_pem.write_bytes( - key.private_bytes(serialization.Encoding.PEM, serialization.PrivateFormat.PKCS8, serialization.NoEncryption()) + key.private_bytes( + serialization.Encoding.PEM, serialization.PrivateFormat.PKCS8, serialization.NoEncryption() + ) ) class OkTlsHandler(BaseHTTPRequestHandler): @@ -1790,11 +1786,8 @@ async def test_bounded_get_preserves_sdk_redirect_auth_and_query_handling(respx_ handler = AsyncHTTPHandler() try: response = await handler.get( - "https://example.com/spec.json?original=1", - max_response_bytes=100, - follow_redirects=True, - headers={"Authorization": "Bearer sentinel", "Accept-Encoding": "gzip"}, - timeout=2.0, + "https://example.com/spec.json?original=1", max_response_bytes=100, follow_redirects=True, + headers={"Authorization": "Bearer sentinel", "Accept-Encoding": "gzip"}, timeout=2.0, ) finally: await handler.close()