test: narrow the async-streaming regression to openai.OpenAIError

Ruff PT011 (test tree) rejects a bare pytest.raises(Exception). Every litellm
exception subclasses an openai one, so OpenAIError is the accurate common base
here and matches the assertion the first test in this file already uses. The
status_code == 400 assertion is unchanged.
This commit is contained in:
Ambuj Upadhyay 2026-09-02 07:27:01 +05:30 • committed by Ambuj Upadhyay
parent 91a3d4ea5e
commit 2bc189ff8f

View file

@ -64,7 +64,7 @@ async def test_async_streaming_missing_credentials_is_not_a_server_error(monkeyp
monkeypatch.setattr(litellm, "api_key", None, raising=False)
monkeypatch.setattr(litellm, "openai_key", None, raising=False)
with pytest.raises(Exception) as exc_info:
with pytest.raises(openai.OpenAIError) as exc_info:
await litellm.acompletion(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "hi"}],