litellm/tests
izzybn 2c4d234466
fix(guardrails): classify only the frames each read completes in Presidio's first-frame wait (#54379)
* fix(guardrails): classify only the frames each read completes in Presidio's first-frame wait

Presidio's wait for the first frame with a JSON object re-split and re-classified its whole buffer on every read, so a long run of leading non-object frames cost CPU quadratic in the number of reads. It now buffers in a bytearray, finds frame ends only in the newly read bytes, and classifies only the frames that read completed

* test(guardrails): check Presidio's first-frame wait classifies each byte once instead of timing it

The test guide bans checks that depend on execution speed, so the CPU-time limit on the many-leading-reads test is replaced by a test that each read is handed only the frames it completed, including frame ends split across reads

* test(guardrails): drive Presidio's real first-frame wait in its per-read classification test

The test copied the wait's loop, so it still passed if the wait itself dropped the offset the classifier returns. The wait now takes the classifier as a parameter, defaulting to the one it called before, and the test runs the real wait with a recording classifier. The classifier docstring now says the caller relays the preface

* test(benchmarks): benchmark Presidio's first-frame wait over many leading reads and a frame split into many reads

Unit tests can't check the wait's cost without timing it, so CodSpeed now times the real wait over 6000 leading non-object reads and over one 48 KB frame in 16-byte reads. Rescanning every classified frame for a JSON object, or searching the whole unclassified tail for a frame end, makes these runs many times slower

* test(proxy): check the SSE frame-end search directly

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-25 11:15:49 +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 feat(vertex-ai)!: support gemini 3.1 flash tts (#31915) 2026-10-21 04:18:42 +00:00
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 feat(gnani): add Prisma v2.5 and v3.0 realtime transcription (#53828) 2026-11-25 10:51:59 +00:00
documentation_tests chore: move workspace packages under litellm (#51000) 2026-11-12 04:19:57 +00:00
e2e fix(gemini): translate validated tool choice (#54191) 2026-11-24 20:47:51 -05: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 fix(harness): set PWD to the working directory of local sandbox commands (#47530) 2026-10-20 20:06:11 +00:00
integration fix(github_copilot): look up a GHE.com shared login's Copilot API on its own tenant (#54366) 2026-11-25 08:30:23 +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 test(rust): update rust-wheel messages tests to main's current behaviour (#54223) 2026-11-24 12:24:37 -08:00
typing chore: move config and docs off the repo root (#50966) 2026-11-11 18:29:35 -08:00
unit fix(guardrails): classify only the frames each read completes in Presidio's first-frame wait (#54379) 2026-11-25 11:15:49 +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.