Files
litellm/tests
Julio Quinteros Pro 5f79bf4906 fix(test): clear tokenizer LRU cache for test isolation
The _select_tokenizer_helper function is decorated with @lru_cache, which
causes test failures when tests run sequentially with --dist=loadscope.
Previous tests' cached results prevent from_pretrained from being called,
causing mock assertions to fail.

Implemented triple-layer cache clearing:
1. Module-level clear on import
2. Class-level clear in setUpClass
3. Function-level clear in setUp + pytest fixture

This ensures test isolation while allowing --dist=loadscope to provide better
overall CI stability (70% pass rate vs 40% without loadscope).

Fixes the intermittent failure in TestTokenizerSelection where
'from_pretrained' mock was never called due to cache hits.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 20:23:27 -03:00
..
2026-02-14 12:59:15 -08:00
2026-02-14 12:28:18 -08:00
2026-02-13 22:01:28 -08:00
2026-02-05 09:40:21 +05:30

In total litellm runs 1000+ tests

[02/20/2025] Update:

To make it easier to contribute and map what behavior is tested,

we've started mapping the litellm directory in tests/test_litellm

This folder can only run mock tests.