mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-12 23:01:41 +00:00
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.
This commit is contained in:
parent
37a45a3295
commit
267cc6307e
1 changed files with 12 additions and 2 deletions
|
|
@ -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):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue