mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-11 21:46:22 +00:00
5f79bf4906
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>
Testing for litellm/
This directory 1:1 maps the the litellm/ directory, and can only contain mocked tests.
The point of this is to:
- Increase test coverage of
litellm/ - Make it easy for contributors to add tests for the
litellm/package and easily run tests without needing LLM API keys.
File name conventions
litellm/proxy/test_caching_routes.pymaps tolitellm/proxy/caching_routes.pytest_<filename>.pymaps tolitellm/<filename>.py