From b1bc3c166d21a5da801e8012de04644c828e6009 Mon Sep 17 00:00:00 2001 From: user <70670632+stuxf@users.noreply.github.com> Date: Tue, 14 Apr 2026 23:37:13 +0000 Subject: [PATCH] test(prompts): isolate in-memory version tests --- .../proxy/prompts/test_prompt_endpoints.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/test_litellm/proxy/prompts/test_prompt_endpoints.py b/tests/test_litellm/proxy/prompts/test_prompt_endpoints.py index 6c2e5fa766..d1a7c59aa3 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 -