The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test: remove dead imports and helpers left behind by legacy test deletion (#45208)
devin-ai-integration[bot]9e871f273605
diff --git a/tests/llm_translation/base_llm_unit_tests.py b/tests/llm_translation/base_llm_unit_tests.pyindex 4e2eecd2f31..e744b6275a8 100644--- a/tests/llm_translation/base_llm_unit_tests.py+++ b/tests/llm_translation/base_llm_unit_tests.py@@ -5,8 +5,6 @@ import sysfrom typing import Any, Dict, Listfrom unittest.mock import MagicMock, Mock, patchimport os-from litellm._uuid import uuid-import timeimport base64import inspect@@ -31,36 +29,6 @@ sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..",-def _usage_format_tests(usage: litellm.Usage):- """- OpenAI prompt caching- - prompt_tokens = sum of non-cache hit tokens + cache-hit tokens- - total_tokens = prompt_tokens + completion_tokens-- Example- ```- "usage": {- "prompt_tokens": 2006,- "completion_tokens": 300,- "total_tokens": 2306,- "prompt_tokens_details": {- "cached_tokens": 1920- },- "completion_tokens_details": {- "reasoning_tokens": 0- }- # ANTHROPIC_ONLY #- "cache_creation_input_tokens": 0- }- ```- """- print(f"usage={usage}")- assert usage.total_tokens == usage.prompt_tokens + usage.completion_tokens-- if usage.prompt_tokens_details is not None:- assert usage.prompt_tokens > usage.prompt_tokens_details.cached_tokens--class BaseLLMChatTest(ABC):"""Abstract base test class that enforces a common test across all test classes.diff --git a/tests/llm_translation/test_bedrock_moonshot.py b/tests/llm_translation/test_bedrock_moonshot.pyindex ac1a8363845..cf5e554e91b 100644--- a/tests/llm_translation/test_bedrock_moonshot.py+++ b/tests/llm_translation/test_bedrock_moonshot.py@@ -12,7 +12,6 @@ This test suite verifies:"""from base_llm_unit_tests import BaseLLMChatTest-import jsonimport litellm@@ -37,7 +36,3 @@ class TestBedrockMoonshotInvoke(BaseLLMChatTest):return {"model": "bedrock/invoke/moonshot.kimi-k2-thinking",}---class TestBedrockMoonshotToolCalling:- """Unit tests for tool calling functionality."""diff --git a/tests/llm_translation/test_gemini.py b/tests/llm_translation/test_gemini.pyindex e30f97df192..d05afe92626 100644--- a/tests/llm_translation/test_gemini.py+++ b/tests/llm_translation/test_gemini.py@@ -16,7 +16,6 @@ import jsonclass TestGoogleAIStudioGemini(BaseLLMChatTest):- test_tool_call_no_arguments = Nonetest_async_pdf_handling_with_file_id = Nonetest_content_list_handling = Nonetest_developer_role_translation = Nonediff --git a/tests/local_testing/test_lunary.py b/tests/local_testing/test_lunary.pyindex c2f67a137c0..4312abcc0a4 100644--- a/tests/local_testing/test_lunary.py+++ b/tests/local_testing/test_lunary.py@@ -2,7 +2,6 @@ import ioimport litellm-from litellm import completionlitellm.failure_callback = ["lunary"]litellm.success_callback = ["lunary"]diff --git a/tests/local_testing/test_streaming.py b/tests/local_testing/test_streaming.pyindex 76301f69c3f..c6582754c3a 100644--- a/tests/local_testing/test_streaming.py+++ b/tests/local_testing/test_streaming.py@@ -22,7 +22,6 @@ load_dotenv()import litellmfrom litellm import (AuthenticationError,- BadRequestError,ModelResponse,RateLimitError,acompletion,@@ -913,14 +912,6 @@ def test_openai_stream_options_call_text_completion() -> None:-# # test on together ai completion call - starcoder---# # test on together ai completion call - starcoder----#### Test Function calling + streaming ####diff --git a/tests/local_testing/test_text_completion.py b/tests/local_testing/test_text_completion.pyindex 69064dfd1f4..d62b141d636 100644--- a/tests/local_testing/test_text_completion.py+++ b/tests/local_testing/test_text_completion.py@@ -1,4 +1,3 @@-import asyncioimport jsonimport osfrom types import MappingProxyTypediff --git a/tests/logging_callback_tests/base_test.py b/tests/logging_callback_tests/base_test.pyindex cc894498f5e..11d89996474 100644--- a/tests/logging_callback_tests/base_test.py+++ b/tests/logging_callback_tests/base_test.py@@ -11,7 +11,7 @@ from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler, HTTPHandlerfrom litellm.utils import CustomStreamWrapper# test_example.py-from abc import ABC, abstractmethod+from abc import ABCclass BaseLoggingCallbackTest(ABC):diff --git a/tests/openai_endpoints_tests/test_openai_batches_endpoint.py b/tests/openai_endpoints_tests/test_openai_batches_endpoint.pyindex bf36ce4d7d1..f488095aa12 100644--- a/tests/openai_endpoints_tests/test_openai_batches_endpoint.py+++ b/tests/openai_endpoints_tests/test_openai_batches_endpoint.py@@ -9,7 +9,6 @@ from typing import Optional, List, Unionfrom test_openai_files_endpoints import upload_file, delete_fileimport sysimport time-from unittest.mock import patchBASE_URL = "http://localhost:4000" # Replace with your actual base URLdiff --git a/tests/pass_through_unit_tests/base_anthropic_unified_messages_test.py b/tests/pass_through_unit_tests/base_anthropic_unified_messages_test.pyindex 40eda77949d..16055b5a29b 100644--- a/tests/pass_through_unit_tests/base_anthropic_unified_messages_test.py+++ b/tests/pass_through_unit_tests/base_anthropic_unified_messages_test.py@@ -15,7 +15,6 @@ from litellm.llms.anthropic.pass_through.messages.handler import (from typing import Optionalfrom litellm.types.utils import StandardLoggingPayloadfrom litellm.integrations.custom_logger import CustomLogger-from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandlerfrom litellm.router import Routerimport importlibfrom litellm.llms.bedrock.base_aws_llm import BaseAWSLLMdiff --git a/tests/test_spend_logs.py b/tests/test_spend_logs.pyindex 310900c257d..57109ea01e5 100644--- a/tests/test_spend_logs.py+++ b/tests/test_spend_logs.py@@ -2,7 +2,7 @@ import os# What this tests?## Tests /spend endpoints.-import pytest, time, uuid, json+import pytest, uuid, jsonimport asyncioimport aiohttp@@ -56,32 +56,6 @@ async def chat_completion(session, key, model="gpt-3.5-turbo"):return await response.json()-async def chat_completion_high_traffic(session, key, model="gpt-3.5-turbo"):- url = "http://0.0.0.0:4000/chat/completions"- headers = {- "Authorization": f"Bearer {key}",- "Content-Type": "application/json",- }- data = {- "model": model,- "messages": [- {"role": "system", "content": "You are a helpful assistant."},- {"role": "user", "content": f"Hello! {uuid.uuid4()}"},- ],- }- try:- async with session.post(url, headers=headers, json=data) as response:- status = response.status- response_text = await response.text()-- if status != 200:- raise Exception(f"Request did not return a 200 status code: {status}")-- return await response.json()- except Exception as e:- return None--async def get_spend_logs(session, request_id=None, api_key=None):if api_key is not None:url = f"http://0.0.0.0:4000/spend/logs?api_key={api_key}"@@ -142,7 +116,7 @@ async def generate_team(session: aiohttp.ClientSession, org_id: str) -> dict:@pytest.mark.skip(- reason="Flaky in CI: /spend/logs?request_id=... returns 500 even after a 20s wait for the spend log to be written. Same write-then-read race against the spend logs DB as test_spend_logs. Spend-log accuracy is covered by tests/unit/proxy/spend_tracking/ and the proxy_spend_accuracy_tests CircleCI job."+ reason="Flaky in CI: /spend/logs?request_id=... returns 500 even after a 20s wait for the spend log to be written. Spend-log accuracy is covered by tests/unit/proxy/spend_tracking/ and the proxy_spend_accuracy_tests CircleCI job.")@pytest.mark.asyncioasync def test_spend_logs_with_org_id():