mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-23 05:34:41 +00:00
test(caching): assert sync cache-hit logging without depending on thread order (#47093)
Sync success callbacks run on a thread pool, so the miss and the two hits can reach the logger in any order. Compare counts instead of the list order.
This commit is contained in:
parent
1552b5b69f
commit
77c2ac18bd
1 changed files with 2 additions and 1 deletions
|
|
@ -42,6 +42,7 @@ from litellm.types.utils import (
|
|||
Embedding,
|
||||
)
|
||||
from litellm.types.llms.openai import ResponsesAPIResponse
|
||||
from collections import Counter
|
||||
from collections.abc import Awaitable, Callable, Mapping
|
||||
from datetime import timedelta, datetime
|
||||
from typing import Final, cast
|
||||
|
|
@ -104,7 +105,7 @@ def test_sync_cache_hits_reach_sync_custom_logger(
|
|||
call(**request_kwargs)
|
||||
|
||||
assert all_logged.wait(timeout=10)
|
||||
assert logged_cache_hits == [None, True, True]
|
||||
assert Counter(logged_cache_hits) == Counter({None: 1, True: 2}), logged_cache_hits
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue