From be7ca9a1716c4202a5e9b113f817136edc03b7b1 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Tue, 19 May 2026 06:51:48 +0000 Subject: [PATCH] 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. --- tests/local_testing/test_custom_callback_input.py | 6 +++++- tests/local_testing/test_stream_chunk_builder.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/local_testing/test_custom_callback_input.py b/tests/local_testing/test_custom_callback_input.py index 545039e60ba..04d83a09ffb 100644 --- a/tests/local_testing/test_custom_callback_input.py +++ b/tests/local_testing/test_custom_callback_input.py @@ -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: diff --git a/tests/local_testing/test_stream_chunk_builder.py b/tests/local_testing/test_stream_chunk_builder.py index 24fdf49c16c..cf61f8b8777 100644 --- a/tests/local_testing/test_stream_chunk_builder.py +++ b/tests/local_testing/test_stream_chunk_builder.py @@ -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: