ref: 5d8cc7194cdea3979993741a1325715ae4331435
parent: 6a72ff0b369d4791002e34d274b624f809a9b883
author: Paul Brossier <piem@piem.org>
date: Sun Aug 21 08:45:04 EDT 2016
python/tests/utils.py: by default, use 5 seconds brownoise
--- a/python/tests/utils.py
+++ b/python/tests/utils.py
@@ -5,6 +5,8 @@
import numpy as np
from tempfile import mkstemp
+DEFAULT_SOUND = '22050Hz_5s_brownnoise.wav'
+
def array_from_text_file(filename, dtype = 'float'):
filename = os.path.join(os.path.dirname(__file__), filename)
with open(filename) as f:
@@ -21,7 +23,11 @@
if len(all_sounds) == 0:
TestCase.skipTest("please add some sounds in \'python/tests/sounds\'")
else:
- return all_sounds[0]
+ default_sound = all_sounds[0]
+ if DEFAULT_SOUND in map(os.path.basename, all_sounds):
+ while os.path.basename(default_sound) != DEFAULT_SOUND:
+ default_sound = all_sounds.pop(0)
+ return default_sound
def get_tmp_sink_path():
fd, path = mkstemp()