The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
refactor: simplify cache clearing to avoid over-engineering
Julio Quinteros Pro706792ba96ba
diff --git a/tests/test_litellm/litellm_core_utils/test_token_counter.py b/tests/test_litellm/litellm_core_utils/test_token_counter.pyindex 85483ba251f..20f9a6e4279 100644--- a/tests/test_litellm/litellm_core_utils/test_token_counter.py+++ b/tests/test_litellm/litellm_core_utils/test_token_counter.py@@ -495,27 +495,14 @@ from litellm.utils import _select_tokenizer_helper, claude_json_str, encoding_select_tokenizer_helper.cache_clear()[email protected](autouse=True, scope="function")-def clear_tokenizer_cache_before_test():- """Clear the LRU cache before each test to ensure test isolation.-- The _select_tokenizer_helper function is decorated with @lru_cache,- which can cause cache hits from previous tests when running with- --dist=loadscope (tests from same file run on same worker).- """- # Clear before test- _select_tokenizer_helper.cache_clear()- yield--class TestTokenizerSelection(unittest.TestCase):- @classmethod- def setUpClass(cls):- """Clear cache before class starts."""- _select_tokenizer_helper.cache_clear()-def setUp(self):- """Clear cache before each test method."""+ """Clear the LRU cache before each test method.++ The _select_tokenizer_helper function is decorated with @lru_cache,+ which can cause cache hits from previous tests when running with+ --dist=loadscope (tests from same file run on same worker).+ """_select_tokenizer_helper.cache_clear()@patch("litellm.utils.Tokenizer.from_pretrained")