litellm/tests/test_litellm
shrey kharbanda 428c0337bb
fix(core): reject a bad stream_chunk_size with a 400 before any prompt hook runs
completion() and acompletion() now read LiteLLM's control settings from kwargs
once, before the prompt management hooks run. A stream_chunk_size written as a
string of digits ("64", which is what a quoted YAML value or os.environ/...
produces) is read as that int. Anything else that is not a positive int
("sixty-four", 64.0, True, 0, -1) fails with a 400 naming the param, for every
provider and whether or not the request streams. With drop_params on, per
request or through litellm.drop_params, the bad value is dropped instead and
default chunking applies. Before, only Bedrock streams checked it, 0 was
accepted, and a Router deployment with a bad value reached the provider

control_params_from returns the typed LiteLLMControlParams or an
InvalidControlParam value, and one match in main.py turns the failure into the
400. completion() adds the validated bag to litellm_params under
CONTROL_PARAMS_KEY after get_litellm_params builds them, so a caller cannot
supply its own. control_params_in reads the bag back. The flat
stream_chunk_size key stays until Bedrock reads the bag

Refs LIT-8317
2026-09-26 01:34:54 +00:00
..
caching fix(caching): propagate auth cache invalidation over Redis Cluster via a node-level pub/sub client (#43110) 2026-09-25 07:56:46 -07:00
expected_responses_api_request
interactions test: move tests/test_litellm root and small trees into tests/unit (#43186) 2026-09-25 11:30:43 -07:00
litellm_core_utils fix(core): reject a bad stream_chunk_size with a 400 before any prompt hook runs 2026-09-26 01:34:54 +00:00
llms test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
ocr test: migrate phase 15 legacy tests to tests/unit 2026-09-20 11:55:43 +00:00
passthrough test: migrate phase 15 legacy tests to tests/unit 2026-09-20 11:55:43 +00:00
proxy fix(proxy): record streamed /v1/responses container ownership before the response.completed frame (#43140) 2026-09-25 13:45:43 -07:00
responses fix(completion_extras): forward non-enum reasoning_effort through the Responses bridge instead of dropping it (#42452) 2026-09-23 11:04:07 -07:00
router_strategy fix(router): count provider budget spend on every API surface (#38172) 2026-09-25 14:06:49 -07:00
router_utils fix(router): match provider-prefixed fallback keys for bare model groups served by wildcard deployments (#43062) 2026-09-24 18:08:56 -07:00
rust_bridge feat(rust): hand upstream response headers to the native Messages stream (#43178) 2026-09-25 10:03:15 -07:00
__init__.py
conftest.py test: move tests/test_litellm root and small trees into tests/unit (#43186) 2026-09-25 11:30:43 -07:00
log.txt
readme.md
test_compression.py test: move tests/test_litellm root and small trees into tests/unit (#43186) 2026-09-25 11:30:43 -07:00
test_conftest.py
test_main.py test: move tests/test_litellm root and small trees into tests/unit (#43186) 2026-09-25 11:30:43 -07:00

Testing for litellm/

This directory 1:1 maps the the litellm/ directory, and can only contain mocked tests.

The point of this is to:

  1. Increase test coverage of litellm/
  2. 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.py maps to litellm/proxy/caching_routes.py
  • test_<filename>.py maps to litellm/<filename>.py