Commit Graph
3 Commits
Author SHA1 Message Date
yuneng-jiangandClaude Opus 4.6 40edb16fb9 Fix test isolation: run eager tiktoken tests in subprocesses
The eager tiktoken tests were clearing all litellm modules from
sys.modules and re-importing, creating new module objects with different
class identities. This broke unittest.mock.patch for all subsequent
tests on the same xdist worker. Running these tests in subprocesses
provides perfect isolation.

Fixes: test_metadata_passed_to_custom_callback_codex_models,
test_oidc_github_success, test_oidc_google_cached,
test_oidc_google_failure,
test_encrypted_content_affinity_bypasses_rpm_limits, and 5 others.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 17:32:31 -07:00
Cesar GarciaandGitHub 807ba011eb fix(main): use local tiktoken cache in lazy loading (#19774)
The lazy loading implementation for encoding in __getattr__ was calling
tiktoken.get_encoding() directly without first setting TIKTOKEN_CACHE_DIR.
This caused tiktoken to attempt downloading the encoding file from the
internet instead of using the local copy bundled with litellm.

This fix uses _get_default_encoding() from _lazy_imports which properly
sets TIKTOKEN_CACHE_DIR before loading tiktoken, ensuring the local cache
is used.
2026-01-27 18:16:58 -08:00
Alexsander HamirandGitHub bb4c01ffa0 Add LITELLM_DISABLE_LAZY_LOADING env var to fix VCR cassette creation issue (#18725) 2026-01-06 14:49:11 -08:00