litellm/tests/image_gen_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
..
request_payloads test(image_gen): align Azure image gen fixture with body omitting model 2026-05-04 18:09:30 +05:30
base_image_generation_test.py fix(ci): remove unused is_expired variable (ruff F841) and handle ModelDeprecated in image gen test 2026-03-12 01:27:42 +00:00
conftest.py fix(tests): stabilize image-edit VCR cassettes to stop live gpt-image-1 spend (#28110) 2026-05-18 09:15:39 -07:00
ishaan_github.png [Feat] Add Image Edits Support to LiteLLM (#11020) 2025-05-21 14:03:09 -07:00
litellm_site.png [Feat] Add Image Edits Support to LiteLLM (#11020) 2025-05-21 14:03:09 -07:00
test_bedrock_image_gen_unit_tests.py test: remove tests that never execute 2026-08-12 10:45:38 -07:00
test_fal_ai_image_generation.py feat(fal_ai): add Nano Banana / Gemini 2.5 Flash Image generation support (#29798) 2026-06-06 11:16:44 -07:00
test_image.png [BETA] Add OpenAI /images/variations + Topaz API support (#7700) 2025-01-11 23:27:46 -08:00
test_image_edit.png test: cleanup tests 2026-03-30 16:20:01 -07:00
test_image_edits.py fix(tests): stabilize image-edit VCR cassettes to stop live gpt-image-1 spend (#28110) 2026-05-18 09:15:39 -07:00
test_image_generation.py test(lint): ban blind pytest.raises(Exception) with ruff B017 (#37731) 2026-08-20 18:09:42 -07:00
test_image_variation.py Fix: varaitions endpoint geting 401 2026-03-09 12:51:21 +05:30
test_xinference.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
vertex_key.json test: update to new vertex ai keys 2026-03-28 20:19:05 -07:00