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:
Bharat Lakhiyani 2026-07-25 00:06:31 -04:00
parent a54e9062a6
commit b2567531f7

View file

@ -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(