mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-06 02:48:13 +00:00
test(bedrock): clear all model-cost LRU caches in local_cost_map fixture
get_model_info.cache_clear() alone leaves _cached_get_model_info_helper (used by completion_cost) holding entries from whichever cost map was active first, making the cost-tracking test order-dependent. Use _invalidate_model_cost_lowercase_map, which clears both caches and the lowercase lookup map.
This commit is contained in:
parent
a54e9062a6
commit
b2567531f7
1 changed files with 3 additions and 2 deletions
|
|
@ -692,16 +692,17 @@ async def test_mantle_anthropic_messages_streaming_sends_stream_and_passes_throu
|
|||
@pytest.fixture
|
||||
def local_cost_map(monkeypatch):
|
||||
import litellm
|
||||
from litellm.utils import _invalidate_model_cost_lowercase_map
|
||||
|
||||
original_model_cost = litellm.model_cost
|
||||
try:
|
||||
monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "true")
|
||||
litellm.model_cost = litellm.get_model_cost_map(url="")
|
||||
litellm.get_model_info.cache_clear()
|
||||
_invalidate_model_cost_lowercase_map()
|
||||
yield
|
||||
finally:
|
||||
litellm.model_cost = original_model_cost
|
||||
litellm.get_model_info.cache_clear()
|
||||
_invalidate_model_cost_lowercase_map()
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue