mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-24 00:52:24 +00:00
test(router): give each prompt caching check test a fresh callback registry
This commit is contained in:
parent
f549c87091
commit
5ea4fe620f
1 changed files with 18 additions and 1 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import asyncio
|
||||
import copy
|
||||
import functools
|
||||
from typing import cast
|
||||
from typing import Final, cast
|
||||
|
||||
import pytest
|
||||
|
||||
|
|
@ -20,6 +20,23 @@ from litellm.utils import get_prompt_cache_min_tokens, is_prompt_caching_valid_p
|
|||
|
||||
MODEL_GROUP_ALIAS = "my-claude-group"
|
||||
OPUS_4_6_MIN_TOKENS = 4096
|
||||
CALLBACK_REGISTRIES: Final = (
|
||||
"input_callback",
|
||||
"success_callback",
|
||||
"failure_callback",
|
||||
"_async_success_callback",
|
||||
"_async_failure_callback",
|
||||
"callbacks",
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _fresh_callback_registries(monkeypatch):
|
||||
"""`litellm.logging_callback_manager` keeps one callback per class, so a
|
||||
`PromptCachingDeploymentCheck` or `_SentMessagesCapture` left behind by an
|
||||
earlier test would swallow the next test's success events."""
|
||||
for registry in CALLBACK_REGISTRIES:
|
||||
monkeypatch.setattr(litellm, registry, [])
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue