litellm/tests/unit/llms/openai
yuneng-jiang ff281dbd14
test(unit): make 21 flaky unit tests deterministic (#54785)
* test(unit): make 20 flaky unit tests deterministic

These tests failed on main and on PR reruns over the last two weeks without a code change. Each fix keeps
what the test proves and only removes the timing, clock or shared-state dependency.

Router usage tests now read usage with usage_since, because the Rust core stamps usage with its own system
clock, so a read in the next minute missed the write. The header parity test checks the remaining count
against the minute the header was read in. The websocket admission test pins the usage-based-routing-v2
clock, and the deployment rpm test freezes time with time-machine because its old patch never reached the
clock bound as a default argument.

The bedrock realtime test stubs AWS signing like its sibling. The swagger test stubs FastAPI's schema
builder. The prisma span scan skips files that cannot hold a call site. The http, live session and custom
code bounds are tied to the timeout constants they guard.

The vertex test reads only LiteLLM log records, the agentops test reads only its own route's requests, the
redis test picks a port whose shared breaker is closed, and the SAML test freezes the clock and now asserts
the exact TTL.

* test(bedrock): stub the boto3 session instead of our own signing helper

Greptile flagged that the realtime guardrail fixture replaced run_aws_signing, which tests/unit/AGENTS.md
forbids. The CI timeout was resolve_credentials building a real boto3.Session on the signing pool, so the
fixture now swaps boto3.Session for a static-key session and the real signing path runs.

* test(s3): keep the short upload deadline for the timeout case only

The dropped-connection case also ran under the 0.3s per-attempt deadline. When the fake bucket's handler
thread answered one attempt late on a loaded runner, that attempt was retried as a timeout instead of a
dropped connection, so the test counted 5 PUTs instead of 6. Only the timeout case needs the short deadline.
2026-11-26 20:48:13 -08:00
..
chat fix(hosted_vllm): keep vLLM's prompt_token_ids on the first streamed chat chunk (#51087) 2026-11-25 19:54:45 -08:00
completion fix(openai): relay param and plain message from OpenAI-compatible backend errors (#53217) 2026-11-20 15:53:54 -08:00
decisions fix(decisions): match OpenAI format answers to questions by name (#52597) 2026-11-18 12:55:45 -08:00
embeddings fix(gemini): support explicit text in embedding inputs (#53135) 2026-11-20 11:05:11 -08:00
evals
image_generation
image_variations
live test(unit): make 21 flaky unit tests deterministic (#54785) 2026-11-26 20:48:13 -08:00
realtime feat(realtime)!: support latest OpenAI audio models (#35600) 2026-11-03 07:27:52 +00:00
responses fix(anthropic): map /v1/messages fields onto OpenAI Responses equivalents or reject them (#54173) 2026-11-25 19:30:01 +00:00
speech
transcriptions perf(import): load realtime and provider cost modules on first use (#54344) 2026-11-26 12:57:05 -08:00
vector_store_files
vector_stores
videos feat(videos): add first-class OpenRouter video request fields (#50319) 2026-11-06 16:50:48 -08:00
__init__.py
test_cost_calculation.py feat(fal_ai): bill fal video clips by duration and resolution (#51679) 2026-11-13 12:55:55 -08:00
test_data_residency.py refactor(types): type the kwargs reads in the responses, images, realtime, files, rerank, batches and fine-tuning entrypoints (#54653) 2026-11-26 10:07:19 +00:00
test_gpt_reasoning_transformation.py fix(llms): treat chat-latest and gpt-chat-latest as gpt-5 family models (#51151) 2026-11-24 04:02:51 -08:00
test_is_model_gpt_5_model.py fix(llms): treat chat-latest and gpt-chat-latest as gpt-5 family models (#51151) 2026-11-24 04:02:51 -08:00
test_o_series_transformation.py fix(openai): drop or refuse an o-series reasoning_effort level the model map turns off (#54066) 2026-11-24 06:42:03 -08:00
test_openai.py fix(openai): preserve omitted headers for chat and embeddings (#53132) 2026-11-20 10:29:22 -08:00
test_openai_audio_speech.py fix(cost): bill OpenAI token-priced aac and flac speech on the length of the returned audio (#53308) 2026-11-21 19:53:23 +00:00
test_openai_authentication_error.py
test_openai_common_utils.py fix(router,files,batches)!: never resend a file or batch create the provider may already have (#51315) 2026-11-25 07:20:51 +00:00
test_openai_empty_response.py
test_openai_file_content_streaming.py
test_openai_image_edit_transformation.py fix(images): send image_edit markup as a multipart file part (#53815) 2026-11-25 04:14:57 +00:00
test_openai_workload_identity.py
test_organization_costs.py
test_use_chat_completions_api_no_leak.py