Skip to content

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]

test(prompts): isolate in-memory version tests

userb1bc3c166d21
diff --git a/tests/test_litellm/proxy/prompts/test_prompt_endpoints.py b/tests/test_litellm/proxy/prompts/test_prompt_endpoints.py
index 6c2e5fa7667..d1a7c59aa3a 100644
--- a/tests/test_litellm/proxy/prompts/test_prompt_endpoints.py
+++ b/tests/test_litellm/proxy/prompts/test_prompt_endpoints.py
@@ -247,8 +247,10 @@ class TestPromptVersionsEndpoint:
),
}
- # Mock the IN_MEMORY_PROMPT_REGISTRY at the import location
- with patch("litellm.proxy.prompts.prompt_registry.IN_MEMORY_PROMPT_REGISTRY") as mock_registry:
+ # Force the in-memory path so this test is isolated from any leaked prisma mocks.
+ with patch("litellm.proxy.proxy_server.prisma_client", None), patch(
+ "litellm.proxy.prompts.prompt_registry.IN_MEMORY_PROMPT_REGISTRY"
+ ) as mock_registry:
mock_registry.IN_MEMORY_PROMPTS = mock_prompts
# Test with base prompt ID
@@ -293,7 +295,9 @@ class TestPromptVersionsEndpoint:
user_role=LitellmUserRoles.PROXY_ADMIN
)
- with patch("litellm.proxy.prompts.prompt_registry.IN_MEMORY_PROMPT_REGISTRY") as mock_registry:
+ with patch("litellm.proxy.proxy_server.prisma_client", None), patch(
+ "litellm.proxy.prompts.prompt_registry.IN_MEMORY_PROMPT_REGISTRY"
+ ) as mock_registry:
mock_registry.IN_MEMORY_PROMPTS = {}
with pytest.raises(HTTPException) as exc_info:
@@ -304,4 +308,3 @@ class TestPromptVersionsEndpoint:
assert exc_info.value.status_code == 404
assert "No versions found" in exc_info.value.detail
-