mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-08 03:08:45 +00:00
test: remove dead imports and helpers left behind by legacy test deletion (#45208)
Co-authored-by: yuneng <yuneng@berri.ai>
This commit is contained in:
parent
87e961fad0
commit
9e871f2736
10 changed files with 3 additions and 80 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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."""
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import io
|
|||
|
||||
|
||||
import litellm
|
||||
from litellm import completion
|
||||
|
||||
litellm.failure_callback = ["lunary"]
|
||||
litellm.success_callback = ["lunary"]
|
||||
|
|
|
|||
|
|
@ -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 ####
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import asyncio
|
||||
import json
|
||||
import os
|
||||
from types import MappingProxyType
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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():
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue