History

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

Paul Brossier committed 7 years ago

Commit 6dc211b1 parent 62000521 file · +11 −10Browse files

Showing the changes to python/tests/test_source.py (1 of 1 file). Show all

Unified · Split

python/tests/test_source.py+11−10
@@ -23,28 +23,29 @@ no_sounds_msg = "no test sounds, add some in 'python/tests/sounds/'!" · 22 unmodified lines
2323
2424 _debug = False
2525
26−class Test_aubio_source_test_case(object):
26+class Test_aubio_source_test_case(TestCase):
2727
28− @parametrize('filename', list_of_sounds)
29− def test_close_file(self, filename):
28+ def setUp(self):
29+ if not default_test_sound:
30+ skipTest(no_sounds_msg)
31+
32+ def test_close_file(self):
3033 samplerate = 0 # use native samplerate
3134 hop_size = 256
32− f = source(filename, samplerate, hop_size)
35+ f = source(default_test_sound, samplerate, hop_size)
3336 f.close()
3437
35− @parametrize('filename', list_of_sounds)
36− def test_close_file_twice(self, filename):
38+ def test_close_file_twice(self):
3739 samplerate = 0 # use native samplerate
3840 hop_size = 256
39− f = source(filename, samplerate, hop_size)
41+ f = source(default_test_sound, samplerate, hop_size)
4042 f.close()
4143 f.close()
4244
43− @parametrize('filename', [default_test_sound])
44− def test_read_after_close(self, filename):
45+ def test_read_after_close(self):
4546 samplerate = 0 # use native samplerate
4647 hop_size = 256
47− f = source(filename, samplerate, hop_size)
48+ f = source(default_test_sound, samplerate, hop_size)
4849 read, frames = f()
4950 f.close()
5051 with assert_raises(RuntimeError):

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t