test(audio): skip when gpt-4o-audio-preview is unavailable upstream

OpenAI retired `gpt-4o-audio-preview` (404 model_not_found in CI as of
2026-05-19), and the existing try/except in these tests only re-raised
on 'openai-internal' errors. Other exceptions were silently swallowed,
so the next line ran with an unbound `response`/`completion` and
failed with an unrelated UnboundLocalError that masked the real cause.

Extend the skip condition to also cover model_not_found / 'does not exist'
so the suite reports the upstream outage cleanly, matching the pattern
used in ce87c41 for the realtime and nvidia_nim rerank tests.
Re-raise unknown exceptions instead of falling through.
This commit is contained in:
mateo-berri 2026-05-19 06:51:48 +00:00
parent 1f064a76e2
commit be7ca9a171
No known key found for this signature in database
2 changed files with 10 additions and 2 deletions

View file

@ -1134,8 +1134,12 @@ def test_standard_logging_payload_audio(turn_off_message_logging, stream):
stream=stream,
)
except Exception as e:
if "openai-internal" in str(e):
err = str(e)
if "openai-internal" in err:
pytest.skip("Skipping test due to openai-internal error")
if "model_not_found" in err or "does not exist" in err:
pytest.skip(f"Skipping test - upstream model unavailable: {err}")
raise
if stream:
for chunk in response:

View file

@ -657,8 +657,12 @@ def test_stream_chunk_builder_openai_audio_output_usage():
stream_options={"include_usage": True},
)
except Exception as e:
if "openai-internal" in str(e):
err = str(e)
if "openai-internal" in err:
pytest.skip("Skipping test due to openai-internal error")
if "model_not_found" in err or "does not exist" in err:
pytest.skip(f"Skipping test - upstream model unavailable: {err}")
raise
chunks = []
for chunk in completion: