litellm/tests/openai_endpoints_tests
ryan-crabbe-berri 680bcfd8aa
test(lint): ban blind pytest.raises(Exception) with ruff B017 (#37731)
* test(lint): ban blind pytest.raises(Exception) with ruff B017

A bare pytest.raises(Exception) accepts whatever the body throws. The TypeError
a refactor introduces satisfies it exactly as well as the rejection the test was
written for, so the crash reads as a pass and the test never goes red.

All 111 existing sites are narrowed here. A runtime probe recorded the concrete
exception each one actually catches, and each site now names that type. Where
the code under test genuinely raises a bare Exception, the site pins a stable
slice of the message with match= instead.

Two sites tell on themselves. The shared responses-API cancel test raises
"custom_llm_provider is required but passed as None" rather than talking to a
provider at all, because cancel_responses takes a provider, not a model. And
test_bedrock_guardrails_with_streaming was the only test in its file still
passing without AWS credentials, because the NoCredentialsError boto3 raised
long before the guardrail ran satisfied the blind raises.

* fix(test): widen the openai batch-dispatch assertion to OpenAIError

The narrowed NotFoundError only holds where OPENAI_API_KEY is set. Without one
the SDK raises OpenAIError while building the client, long before any 404, so CI
went red. OpenAIError covers both and still rejects a TypeError from a refactor.
2026-08-20 18:09:42 -07:00
..
bedrock_batch_completions.jsonl test fix us.anthropic.claude-haiku-4-5-20251001-v1:0 (#24931) 2026-04-01 11:01:03 -07:00
input.jsonl rename folder to test openai endpoints 2025-03-13 15:13:48 -07:00
input_azure.jsonl [Feat] Add support for returning images with gemini/gemini-2.5-flash-image-preview with /chat/completions (#13983) 2025-08-27 16:16:19 -07:00
openai_batch_completions.jsonl rename folder to test openai endpoints 2025-03-13 15:13:48 -07:00
openai_fine_tuning.jsonl rename folder to test openai endpoints 2025-03-13 15:13:48 -07:00
out.jsonl rename folder to test openai endpoints 2025-03-13 15:13:48 -07:00
out_azure.jsonl rename folder to test openai endpoints 2025-03-13 15:13:48 -07:00
test_batch_rate_limiting_integration.jsonl [Feat] Add support for Batch API Rate limiting - PR1 adds support for input based rate limits (#16075) 2025-10-29 18:28:52 -07:00
test_bedrock_batches_api.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_e2e_openai_responses_api.py test(lint): ban blind pytest.raises(Exception) with ruff B017 (#37731) 2026-08-20 18:09:42 -07:00
test_openai_batches_endpoint.py fix(batches): register managed output files on batch cancel 2026-08-05 18:28:52 -07:00
test_openai_files_endpoints.py E2E test to assert response headers from the openai files change 2026-04-10 18:45:00 +00:00
test_openai_fine_tuning.py chore(ci): modernize model references in tests and configs (#27856) 2026-05-15 15:44:28 -07:00
test_responses_websocket_proxy_e2e.py chore(ci): modernize model references in tests and configs (#27856) 2026-05-15 15:44:28 -07:00