Files
litellm/tests
Julio Quinteros Pro fd1237e9af fix(token-counter): fix test isolation and encode() return type normalization
Two independent fixes for test_token_counter.py failures in CI:

1. test_disable_hf_tokenizer_download leaked litellm.disable_hf_tokenizer_download=True
   because pytest.MonkeyPatch() was never undone. The setting persisted into the
   alphabetically-subsequent test_llama2/3_tokenizer_api_failure tests, causing
   _select_tokenizer_helper to short-circuit before calling from_pretrained.
   Fix: wrap the test body in try/finally and call monkeypatch.undo().

2. encode() returns a HuggingFace Encoding object when the HF tokenizer loads, but
   falls back to returning a plain List[int] (tiktoken) when the model hub is
   unreachable. test_encoding_and_decoding called .ids on the result, which raises
   AttributeError when the list-based fallback is active.
   Fix: normalize encode() to always return List[int] by extracting .ids when present,
   and remove the now-unnecessary .ids access in the test.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-17 20:07:52 -03:00
..
2026-02-14 12:59:15 -08:00
2026-01-20 18:37:56 +05:30
2026-01-31 19:08:07 -08:00
2026-01-22 10:50:23 -08:00
2026-01-22 15:21:44 -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.