litellm/tests
T. Cheyney Loffing 13e2d56066
fix(streaming): keep streamed usage when SSE lines without data precede the usage event (#54052)
* fix(watsonx): keep streamed usage when SSE id and event fields precede the usage event

* fix(streaming): pass only data and raw JSON lines to the parser in both chat stream readers

Both the OpenAI-like reader and the base reader that most OpenAI-compatible
providers use turned SSE lines without a payload (id, event, retry, comments
and unknown fields) into empty chunks, which end the stream after
finish_reason and drop the usage event that follows

* test(watsonx): cover retry and comment SSE lines and the async stream iterator

* fix(streaming): skip SSE data lines with no payload in the base stream reader

* refactor(responses): drop the unreachable event and empty line branch in the chat bridge stream reader

Both base stream reader loops skip lines without a payload before calling _handle_string_chunk, so this branch can no longer run

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-25 20:31:21 +00:00
..
_support test(rate-limit): wait for the Rust limiter's queued log lines before comparing them (#54257) 2026-11-24 21:17:18 +00:00
audio_tests
base_sdk_tests fix(packaging): ship the license public key in the litellm-proxy sdist (#52970) 2026-11-19 23:18:32 +00:00
basic_proxy_startup_tests feat(docker)!: one shipped image and one entrypoint beside the Dockerfile (#43332) 2026-11-10 18:32:16 -08:00
benchmarks fix(guardrails): classify only the frames each read completes in Presidio's first-frame wait (#54379) 2026-11-25 11:15:49 +00:00
code_coverage_tests fix(anthropic): map /v1/messages fields onto OpenAI Responses equivalents or reject them (#54173) 2026-11-25 19:30:01 +00:00
documentation_tests chore: move workspace packages under litellm (#51000) 2026-11-12 04:19:57 +00:00
e2e refactor(ui): move MCP Tool Search, MCP Semantic Filter, and Web Search Interception settings onto the form kit (#54449) 2026-11-25 11:35:15 -08:00
e2e_harness test(e2e): move the Claude Code matrix to Opus, Sonnet and Haiku 5.5, Fable 5.2 and GPT-6 (#54305) 2026-11-25 01:47:03 +00:00
fixtures
harness_e2e
integration fix(anthropic): map /v1/messages fields onto OpenAI Responses equivalents or reject them (#54173) 2026-11-25 19:30:01 +00:00
rust-python-harness fix(gateway): serve messages drop, summary and timeout settings like Python (#51236) 2026-11-25 09:26:12 +00:00
test_litellm_rust feat(anthropic-messages): per-deployment deferred_tools handling on the /v1/messages bridge (#54183) 2026-11-25 17:14:28 +00:00
typing chore: move config and docs off the repo root (#50966) 2026-11-11 18:29:35 -08:00
unit fix(streaming): keep streamed usage when SSE lines without data precede the usage event (#54052) 2026-11-25 20:31:21 +00:00
windows_tests ci(unit): cut unit check time with cheaper per-test resets and fewer non-unit tests (#51864) 2026-11-14 15:41:30 -08:00
__init__.py
_fake_openai_endpoint_server.py
_flush_vcr_cache.py
_live_test_helpers.py
_master_key.py
_module_state.py ci(unit): cut unit check time with cheaper per-test resets and fewer non-unit tests (#51864) 2026-11-14 15:41:30 -08:00
_openai_record_replay_proxy.py
_process_helpers.py
_vcr_conftest_common.py ci: remove CircleCI (#50950) 2026-11-11 15:38:27 -08:00
_vcr_redis_persister.py
_wait_helpers.py
_ws_vcr.py
AGENTS.md
capturing_transport.py
eval_swe_bench.py
fake_openai_endpoint.py
gettysburg.wav
large_text.py
openai_batch_completions.jsonl
pyrightconfig.json
README.MD
test_logging.conf
test_rust_python_harness.py
VCR_TESTING.md
white_100x100.png

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/unit

This folder can only run mock tests.