π π A Python library for audio.
C audioaudio-processingaudio-productionaudio-researchaudio-unitaugmentationjucemachine-learningpybind11pythonvst3vst3-host
Fix flakey test. (#241)
Peter Sobotc77b6d12655c
diff --git a/tests/test_io.py b/tests/test_io.pyindex 22c1b5f..86c309a 100644--- a/tests/test_io.py+++ b/tests/test_io.py@@ -1110,11 +1110,12 @@ def test_mp3_duration_estimate(samplerate: float, target_samplerate: float, chun) as f:original_frame_estimate = f.framestotal_frames_read = 0- while f.tell() < f.frames:+ # When resampling, we may need to call read() one more time after getting f.frames+ # out of the file to ensure that we've pulled all of the data from the original file+ # _and_ exhausted any resampler buffers.+ while f.tell() < f.frames or not f.exact_duration_known:frames_read = f.read(chunk_size).shape[1]total_frames_read += frames_read- if not frames_read:- breakassert f.exact_duration_knownassert abs(total_frames_read - int(audio.shape[1] * (target_samplerate / samplerate))) <= 1assert total_frames_read == f.frames