mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
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 <noreply@anthropic.com>
This commit is contained in:
parent
f0fc44c244
commit
ea0cfac995
1 changed files with 8 additions and 0 deletions
|
|
@ -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."""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue