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_no_duplicate_spend_logs
Ishaan Jaffer71ea926f9ad2
diff --git a/tests/test_litellm/responses/test_no_duplicate_spend_logs.py b/tests/test_litellm/responses/test_no_duplicate_spend_logs.pyindex 249374b3078..19b4d5f5242 100644--- a/tests/test_litellm/responses/test_no_duplicate_spend_logs.py+++ b/tests/test_litellm/responses/test_no_duplicate_spend_logs.py@@ -5,8 +5,10 @@ This test verifies the fix for issue #15740 where kwargs.pop() was removingthe logging object before passing kwargs to internal acompletion() calls,causing duplicate spend log entries for non-OpenAI providers."""-import sys+import asyncioimport os+import sys+import pytestsys.path.insert(@@ -26,6 +28,7 @@ def test_logging_object_not_popped():spend logs for non-OpenAI providers."""import inspect+from litellm.responses import main as responses_module# Get the source code of the responses function@@ -84,9 +87,11 @@ async def test_no_duplicate_spend_logs():)# Wait for async logging to complete using the logging worker's flush method- # This is more reliable than sleep() which can cause race conditions+ # Then add a small delay to ensure callbacks finish executingfrom litellm.litellm_core_utils.logging_worker import GLOBAL_LOGGING_WORKERawait GLOBAL_LOGGING_WORKER.flush()+ # flush() empties the queue but callbacks may still be running+ await asyncio.sleep(0.5)# Verify that log_success_event was called exactly onceassert spend_logger.log_count == 1, (