Skip to content

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]

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.py
index 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 sys
from typing import Any, Dict, List
from unittest.mock import MagicMock, Mock, patch
import os
-from litellm._uuid import uuid
-import time
import base64
import 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.py
index 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 json
import 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.py
index e30f97df192..d05afe92626 100644
--- a/tests/llm_translation/test_gemini.py
+++ b/tests/llm_translation/test_gemini.py
@@ -16,7 +16,6 @@ import json
class TestGoogleAIStudioGemini(BaseLLMChatTest):
- test_tool_call_no_arguments = None
test_async_pdf_handling_with_file_id = None
test_content_list_handling = None
test_developer_role_translation = None
diff --git a/tests/local_testing/test_lunary.py b/tests/local_testing/test_lunary.py
index c2f67a137c0..4312abcc0a4 100644
--- a/tests/local_testing/test_lunary.py
+++ b/tests/local_testing/test_lunary.py
@@ -2,7 +2,6 @@ import io
import litellm
-from litellm import completion
litellm.failure_callback = ["lunary"]
litellm.success_callback = ["lunary"]
diff --git a/tests/local_testing/test_streaming.py b/tests/local_testing/test_streaming.py
index 76301f69c3f..c6582754c3a 100644
--- a/tests/local_testing/test_streaming.py
+++ b/tests/local_testing/test_streaming.py
@@ -22,7 +22,6 @@ load_dotenv()
import litellm
from 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.py
index 69064dfd1f4..d62b141d636 100644
--- a/tests/local_testing/test_text_completion.py
+++ b/tests/local_testing/test_text_completion.py
@@ -1,4 +1,3 @@
-import asyncio
import json
import os
from types import MappingProxyType
diff --git a/tests/logging_callback_tests/base_test.py b/tests/logging_callback_tests/base_test.py
index 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, HTTPHandler
from litellm.utils import CustomStreamWrapper
# test_example.py
-from abc import ABC, abstractmethod
+from abc import ABC
class BaseLoggingCallbackTest(ABC):
diff --git a/tests/openai_endpoints_tests/test_openai_batches_endpoint.py b/tests/openai_endpoints_tests/test_openai_batches_endpoint.py
index 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, Union
from test_openai_files_endpoints import upload_file, delete_file
import sys
import time
-from unittest.mock import patch
BASE_URL = "http://localhost:4000" # Replace with your actual base URL
diff --git a/tests/pass_through_unit_tests/base_anthropic_unified_messages_test.py b/tests/pass_through_unit_tests/base_anthropic_unified_messages_test.py
index 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 Optional
from litellm.types.utils import StandardLoggingPayload
from litellm.integrations.custom_logger import CustomLogger
-from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler
from litellm.router import Router
import importlib
from litellm.llms.bedrock.base_aws_llm import BaseAWSLLM
diff --git a/tests/test_spend_logs.py b/tests/test_spend_logs.py
index 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, json
import asyncio
import 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.asyncio
async def test_spend_logs_with_org_id():