From ea0cfac9957b7a122211f5b11a85083554d53e3f Mon Sep 17 00:00:00 2001 From: Julio Quinteros Pro Date: Tue, 17 Feb 2026 21:02:56 -0300 Subject: [PATCH] fix(tests): add cache flush fixture for reliable HTTP client isolation Add _reset_litellm_http_client_cache autouse fixture (matching test_vertex_gemma_transformation.py) to flush in_memory_llm_clients_cache before each test. Without this, a cached real AsyncHTTPHandler from an earlier test could bypass the class-level mock and cause real HTTP calls. Co-Authored-By: Claude Sonnet 4.6 --- .../gpt_oss/test_vertex_ai_gpt_oss_transformation.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_litellm/llms/vertex_ai/vertex_ai_partner_models/gpt_oss/test_vertex_ai_gpt_oss_transformation.py b/tests/test_litellm/llms/vertex_ai/vertex_ai_partner_models/gpt_oss/test_vertex_ai_gpt_oss_transformation.py index fb5529d4752..b6d6402bcd4 100644 --- a/tests/test_litellm/llms/vertex_ai/vertex_ai_partner_models/gpt_oss/test_vertex_ai_gpt_oss_transformation.py +++ b/tests/test_litellm/llms/vertex_ai/vertex_ai_partner_models/gpt_oss/test_vertex_ai_gpt_oss_transformation.py @@ -15,6 +15,14 @@ from litellm.llms.vertex_ai.vertex_ai_partner_models.gpt_oss.transformation impo ) +@pytest.fixture(autouse=True) +def _reset_litellm_http_client_cache(): + """Ensure each test gets a fresh async HTTP client mock.""" + from litellm import in_memory_llm_clients_cache + + in_memory_llm_clients_cache.flush_cache() + + @pytest.fixture(autouse=True) def clean_vertex_env(): """Clear Google/Vertex AI environment variables before each test to prevent test isolation issues."""