fix(ci): avoid SSE import cycle and stabilize prompt version tests

This commit is contained in:
afoninsky 2026-04-09 13:39:30 +02:00
parent 761221de26
commit 246d924038
No known key found for this signature in database
GPG key ID: 79690EED417BC43E
2 changed files with 7 additions and 4 deletions

View file

@ -26,6 +26,7 @@ from pydantic import BaseModel
import litellm
from litellm import ModelResponse
from litellm._logging import verbose_logger
from litellm.litellm_core_utils.streaming_handler import CustomStreamWrapper
from litellm.llms.base_llm.base_model_iterator import BaseModelResponseIterator
from litellm.llms.base_llm.bridges.completion_transformation import (
CompletionTransformationBridge,
@ -39,7 +40,6 @@ from litellm.types.llms.openai import (
ResponsesAPIStreamEvents,
)
from litellm.types.utils import GenericStreamingChunk, ModelResponseStream
from litellm.utils import CustomStreamWrapper
if TYPE_CHECKING:
from openai.types.responses import ResponseInputImageParam

View file

@ -248,7 +248,9 @@ 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:
with patch(
"litellm.proxy.prompts.prompt_registry.IN_MEMORY_PROMPT_REGISTRY"
) as mock_registry, patch("litellm.proxy.proxy_server.prisma_client", None):
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.prompts.prompt_registry.IN_MEMORY_PROMPT_REGISTRY"
) as mock_registry, patch("litellm.proxy.proxy_server.prisma_client", None):
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