diff --git a/tests/test_litellm/proxy/test_proxy_utils.py b/tests/test_litellm/proxy/test_proxy_utils.py index 9506275be51..bc86d3311af 100644 --- a/tests/test_litellm/proxy/test_proxy_utils.py +++ b/tests/test_litellm/proxy/test_proxy_utils.py @@ -1,7 +1,6 @@ import datetime as real_datetime import smtplib from typing import Final -from unittest.mock import MagicMock, patch import pytest from fastapi import HTTPException @@ -10,10 +9,15 @@ from litellm.caching.caching import DualCache from litellm.integrations.custom_guardrail import CustomGuardrail from litellm.integrations.custom_logger import CustomLogger from litellm.proxy._types import ProxyErrorTypes, UserAPIKeyAuth -from litellm.proxy.utils import PrismaClient, ProxyLogging, get_custom_url, join_paths +from litellm.proxy.utils import PrismaClient, ProxyLogging from litellm.types.guardrails import GuardrailEventHooks +from unittest.mock import MagicMock, patch + +from litellm.proxy.utils import get_custom_url, join_paths + + def test_get_custom_url(monkeypatch): monkeypatch.setenv("SERVER_ROOT_PATH", "/litellm") custom_url = get_custom_url(request_base_url="http://0.0.0.0:4000", route="ui/") @@ -2139,7 +2143,9 @@ def test_create_model_info_response_resolves_alias_to_deployment_model(): ] ) - response = create_model_info_response(model_id="bedrock-claude-opus-5", provider="openai", llm_router=router) + response = create_model_info_response( + model_id="bedrock-claude-opus-5", provider="openai", llm_router=router + ) finally: litellm.model_cost.clear() litellm.model_cost.update(saved_model_cost) @@ -2168,7 +2174,9 @@ def test_create_model_info_response_keeps_exact_alias_over_generalized_deploymen ] ) - response = create_model_info_response(model_id="claude-opus-5", provider="openai", llm_router=router) + response = create_model_info_response( + model_id="claude-opus-5", provider="openai", llm_router=router + ) finally: litellm.model_cost.clear() litellm.model_cost.update(saved_model_cost) @@ -2192,7 +2200,9 @@ def test_create_model_info_response_falls_back_to_alias_for_opaque_deployment_na ] ) - response = create_model_info_response(model_id="gpt-4o", provider="openai", llm_router=router) + response = create_model_info_response( + model_id="gpt-4o", provider="openai", llm_router=router + ) finally: litellm.model_cost.clear() litellm.model_cost.update(saved_model_cost) @@ -2217,7 +2227,9 @@ def test_create_model_info_response_resolves_mode_through_deployment_model(): ] ) - response = create_model_info_response(model_id="my-embeddings", provider="openai", llm_router=router) + response = create_model_info_response( + model_id="my-embeddings", provider="openai", llm_router=router + ) finally: litellm.model_cost.clear() litellm.model_cost.update(saved_model_cost) @@ -2295,9 +2307,7 @@ async def test_post_call_failure_hook_redacts_traceback_before_callbacks(monkeyp with patch.object(proxy_logging_obj, "update_request_status", new=AsyncMock()): await proxy_logging_obj.post_call_failure_hook( request_data={"metadata": {}}, - original_exception=HTTPException( - status_code=400, detail="Upstream passthrough request failed with status 400" - ), + original_exception=HTTPException(status_code=400, detail="Upstream passthrough request failed with status 400"), user_api_key_dict=UserAPIKeyAuth(), traceback_str=upstream_traceback, )