From acfaea9d259a75945da2e6df623f1603b262c712 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Sun, 15 Mar 2026 23:55:44 -0700 Subject: [PATCH] [Fix] Reset api_base/api_key in xdist conftest to prevent cross-test leakage test_rerank.py sets litellm.api_base = "http://localhost:4000" which leaked to all subsequent tests on the same xdist worker, causing connection failures across every provider (Cohere, Azure, OpenAI, etc.). Co-Authored-By: Claude Opus 4.6 --- tests/llm_translation/conftest.py | 3 +++ tests/local_testing/conftest.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/tests/llm_translation/conftest.py b/tests/llm_translation/conftest.py index 46a3a31771..e258bafc01 100644 --- a/tests/llm_translation/conftest.py +++ b/tests/llm_translation/conftest.py @@ -30,6 +30,9 @@ _SCALAR_DEFAULTS = { "force_ipv4": getattr(litellm, "force_ipv4", False), "drop_params": getattr(litellm, "drop_params", None), "modify_params": getattr(litellm, "modify_params", False), + "api_base": getattr(litellm, "api_base", None), + "api_key": getattr(litellm, "api_key", None), + "cohere_key": getattr(litellm, "cohere_key", None), } diff --git a/tests/local_testing/conftest.py b/tests/local_testing/conftest.py index a6b31caff2..0013f25357 100644 --- a/tests/local_testing/conftest.py +++ b/tests/local_testing/conftest.py @@ -43,6 +43,8 @@ _SCALAR_DEFAULTS = { "force_ipv4": getattr(litellm, "force_ipv4", False), "drop_params": getattr(litellm, "drop_params", None), "modify_params": getattr(litellm, "modify_params", False), + "api_base": getattr(litellm, "api_base", None), + "api_key": getattr(litellm, "api_key", None), }