shithub: aubio

Download patch

ref: 6dc211bb25365943bf783abf7d9745f19e826223
parent: 6200052165d1103fd2a00e50058ff9fc68cccd10
author: Paul Brossier <piem@piem.org>
date: Fri Dec 21 11:39:56 EST 2018

[tests] simplify test_source.py, skip if no test sounds

--- a/python/tests/test_source.py
+++ b/python/tests/test_source.py
@@ -23,28 +23,29 @@
 
 _debug = False
 
-class Test_aubio_source_test_case(object):
+class Test_aubio_source_test_case(TestCase):
 
-    @parametrize('filename', list_of_sounds)
-    def test_close_file(self, filename):
+    def setUp(self):
+        if not default_test_sound:
+            skipTest(no_sounds_msg)
+
+    def test_close_file(self):
         samplerate = 0 # use native samplerate
         hop_size = 256
-        f = source(filename, samplerate, hop_size)
+        f = source(default_test_sound, samplerate, hop_size)
         f.close()
 
-    @parametrize('filename', list_of_sounds)
-    def test_close_file_twice(self, filename):
+    def test_close_file_twice(self):
         samplerate = 0 # use native samplerate
         hop_size = 256
-        f = source(filename, samplerate, hop_size)
+        f = source(default_test_sound, samplerate, hop_size)
         f.close()
         f.close()
 
-    @parametrize('filename', [default_test_sound])
-    def test_read_after_close(self, filename):
+    def test_read_after_close(self):
         samplerate = 0 # use native samplerate
         hop_size = 256
-        f = source(filename, samplerate, hop_size)
+        f = source(default_test_sound, samplerate, hop_size)
         read, frames = f()
         f.close()
         with assert_raises(RuntimeError):