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(test): add environment cleanup for Vertex AI rerank tests
Julio Quinteros Pro28a0c61c513d
diff --git a/tests/test_litellm/llms/vertex_ai/rerank/test_vertex_ai_rerank_transformation.py b/tests/test_litellm/llms/vertex_ai/rerank/test_vertex_ai_rerank_transformation.pyindex c1de7933f95..fbf5239797f 100644--- a/tests/test_litellm/llms/vertex_ai/rerank/test_vertex_ai_rerank_transformation.py+++ b/tests/test_litellm/llms/vertex_ai/rerank/test_vertex_ai_rerank_transformation.py@@ -15,9 +15,30 @@ from litellm.types.rerank import RerankResponseclass TestVertexAIRerankTransform:def setup_method(self):+ # Save and clear Google/Vertex AI environment variables to prevent+ # test isolation issues where previous tests leave credentials set+ self._saved_env = {}+ env_vars_to_clear = [+ "GOOGLE_APPLICATION_CREDENTIALS",+ "GOOGLE_CLOUD_PROJECT",+ "VERTEXAI_PROJECT",+ "VERTEX_PROJECT",+ "VERTEX_LOCATION",+ "VERTEX_AI_PROJECT",+ ]+ for var in env_vars_to_clear:+ if var in os.environ:+ self._saved_env[var] = os.environ[var]+ del os.environ[var]+self.config = VertexAIRerankConfig()self.model = "semantic-ranker-default@latest"+ def teardown_method(self):+ # Restore saved environment variables+ for var, value in self._saved_env.items():+ os.environ[var] = value+@patch('litellm.llms.vertex_ai.rerank.transformation.VertexAIRerankConfig._ensure_access_token')def test_get_complete_url(self, mock_ensure_access_token):"""Test URL generation for Vertex AI Discovery Engine rerank API."""