From 9045a2df9e1dcb5a0a04f1fff50acaba69d158d4 Mon Sep 17 00:00:00 2001 From: yucheng Date: Fri, 25 Sep 2026 18:30:14 +0000 Subject: [PATCH] test(passthrough): drop the fastapi import from the normalization tests Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../litellm_core_utils/test_error_normalization.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/test_litellm/litellm_core_utils/test_error_normalization.py b/tests/test_litellm/litellm_core_utils/test_error_normalization.py index 750a4fff29a..b7c724584ac 100644 --- a/tests/test_litellm/litellm_core_utils/test_error_normalization.py +++ b/tests/test_litellm/litellm_core_utils/test_error_normalization.py @@ -166,25 +166,21 @@ def test_variants_of_one_failure_share_a_normalized_error(messages: tuple[Except def test_normalize_error_passthrough_prefix_wins_over_upstream_body_text() -> None: - from fastapi import HTTPException - for detail in ( 'Upstream passthrough request failed with status 400: {"error": {"message": "no deployments available for this model"}}', 'Upstream passthrough request failed with status 400: {"error": {"message": "max budget reached"}}', ): - exc = HTTPException(status_code=400, detail=detail) + exc = Exception(detail) message = f"400: {detail}" assert normalize_error(exc, "400", message) == "500_UPSTREAM_PASSTHROUGH", message def test_normalize_error_passthrough_prefix_wins_over_quota_and_budget_wording() -> None: - from fastapi import HTTPException - detail = ( 'Upstream passthrough request failed with status 429: {"error": {"message": ' '"You exceeded your current quota, please check your plan and billing details. Budget spent"}}' ) - exc = HTTPException(status_code=429, detail=detail) + exc = Exception(detail) assert normalize_error(exc, "429", f"429: {detail}") == "500_UPSTREAM_PASSTHROUGH"