From 267cc6307e97689d26f2f4b9072e6da51a39a909 Mon Sep 17 00:00:00 2001 From: shin-bot-litellm Date: Sun, 1 Feb 2026 00:09:31 +0000 Subject: [PATCH] fix(test): skip test_bytesio_at_end_position when soundfile unavailable The test was using an environment variable SKIP_AUDIO_TESTS to skip the test, but this doesn't work reliably because: 1. The env var may not be set in all environments 2. The actual dependency check should be for soundfile module This changes the skipif to check if soundfile can actually be imported, making the test skip gracefully in environments where soundfile is not installed while still running in CI where it is available. --- .../litellm_core_utils/test_audio_utils.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/test_litellm/litellm_core_utils/test_audio_utils.py b/tests/test_litellm/litellm_core_utils/test_audio_utils.py index 23c61ce90f0..fd30d444da2 100644 --- a/tests/test_litellm/litellm_core_utils/test_audio_utils.py +++ b/tests/test_litellm/litellm_core_utils/test_audio_utils.py @@ -210,12 +210,22 @@ class TestProcessAudioFile: assert result.content_type == "audio/wav" +def _soundfile_available() -> bool: + """Check if soundfile module is available.""" + try: + import soundfile # noqa: F401 + + return True + except ImportError: + return False + + class TestCalculateRequestDuration: """Test the calculate_request_duration function""" @pytest.mark.skipif( - os.environ.get("SKIP_AUDIO_TESTS") == "true", - reason="Skipping audio tests - soundfile may not be available", + not _soundfile_available(), + reason="soundfile module not available", ) def test_bytesio_at_end_position(self): """