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
fix: address Greptile review feedback for test isolation
Julio Quinteros Pro77f315eb11ff
diff --git a/tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_anthropic_experimental_pass_through_messages_handler.py b/tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_anthropic_experimental_pass_through_messages_handler.pyindex 376d14416a3..77c74a7847e 100644--- a/tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_anthropic_experimental_pass_through_messages_handler.py+++ b/tests/test_litellm/llms/anthropic/experimental_pass_through/messages/test_anthropic_experimental_pass_through_messages_handler.py@@ -33,7 +33,7 @@ def test_anthropic_experimental_pass_through_messages_handler():except Exception as e:print(f"Error: {e}")mock_completion.assert_called_once()- mock_completion.call_args.kwargs["api_key"] == "test-api-key"+ assert mock_completion.call_args.kwargs["api_key"] == "test-api-key"def test_anthropic_experimental_pass_through_messages_handler_dynamic_api_key_and_api_base_and_custom_values():@@ -57,9 +57,9 @@ def test_anthropic_experimental_pass_through_messages_handler_dynamic_api_key_anexcept Exception as e:print(f"Error: {e}")mock_completion.assert_called_once()- mock_completion.call_args.kwargs["api_key"] == "test-api-key"- mock_completion.call_args.kwargs["api_base"] == "test-api-base"- mock_completion.call_args.kwargs["custom_key"] == "custom_value"+ assert mock_completion.call_args.kwargs["api_key"] == "test-api-key"+ assert mock_completion.call_args.kwargs["api_base"] == "test-api-base"+ assert mock_completion.call_args.kwargs["custom_key"] == "custom_value"def test_anthropic_experimental_pass_through_messages_handler_custom_llm_provider():diff --git a/tests/test_litellm/proxy/guardrails/test_pillar_guardrails.py b/tests/test_litellm/proxy/guardrails/test_pillar_guardrails.pyindex ece38eb386c..cd7e726bdd7 100644--- a/tests/test_litellm/proxy/guardrails/test_pillar_guardrails.py+++ b/tests/test_litellm/proxy/guardrails/test_pillar_guardrails.py@@ -51,14 +51,16 @@ def setup_and_teardown():import asyncioimport importlibimport sys+ global litellm# Reload litellm to ensure clean state# During parallel test execution, another worker might have removed litellm from sys.modules# so we need to ensure it's imported before reloadingif "litellm" not in sys.modules:- import litellm as _litellm+ import litellm as fresh_litellm+ litellm = fresh_litellm # Update module-level referenceelse:- importlib.reload(litellm)+ litellm = importlib.reload(litellm) # Update module-level reference with reloaded module# Set up async looploop = asyncio.get_event_loop_policy().new_event_loop()diff --git a/tests/test_litellm/proxy/test_proxy_server.py b/tests/test_litellm/proxy/test_proxy_server.pyindex aefd19ef3c3..2696867d017 100644--- a/tests/test_litellm/proxy/test_proxy_server.py+++ b/tests/test_litellm/proxy/test_proxy_server.py@@ -681,10 +681,12 @@ def test_embedding_input_array_of_tokens(client_no_auth):"""from litellm.proxy import proxy_server- # Apply the mock AFTER client_no_auth fixture has initialized the router- # This avoids issues with llm_router being None during parallel test execution- if proxy_server.llm_router is None:- pytest.skip("llm_router not initialized - skipping test")+ # The client_no_auth fixture should initialize the router+ # Assert this to catch any router initialization regressions+ assert proxy_server.llm_router is not None, (+ "llm_router is None after client_no_auth fixture initialized. "+ "This indicates a router initialization issue that should be investigated."+ )try:with mock.patch.object(