History

[tests] use run_module_suite so tests can run when pytest is not installed

Paul Brossier committed 8 years ago

Commit 7fd92ca1 parent 8607a746 files · +14 −10Browse files

Showing the changes to python (6 of 6 files). Show all

Unified · Split

6 files
  1. python/tests/_tools.py +4 −0
  2. python/tests/test_mfcc.py +2 −2
  3. python/tests/test_midi2note.py +2 −2
  4. python/tests/test_note2midi.py +2 −2
  5. python/tests/test_sink.py +2 −2
  6. python/tests/test_source.py +2 −2
python/tests/_tools.py+4−0
@@ -21,6 +21,9 @@ try: · 20 unmodified lines
21 assert_warns = pytest.warns21 assert_warns = pytest.warns
22 skipTest = pytest.skip22 skipTest = pytest.skip
23 _has_pytest = True23 _has_pytest = True
24 def run_module_suite():
25 import sys, pytest
26 pytest.main(sys.argv)
24except:27except:
25 pass28 pass
26 29
@@ -31,6 +34,7 @@ if not _has_pytest: · 4 unmodified lines
31 parametrize = dec.parametrize34 parametrize = dec.parametrize
32 def skipTest(msg):35 def skipTest(msg):
33 raise SkipTest(msg)36 raise SkipTest(msg)
37 from numpy.testing import run_module_suite
34 38
35# always use numpy's assert_equal39# always use numpy's assert_equal
36import numpy40import numpy
python/tests/test_mfcc.py+2−2
@@ -106,5 +106,5 @@ class Test_aubio_mfcc_all_parameters(object): · 105 unmodified lines
106 #print coeffs106 #print coeffs
107 107
108if __name__ == '__main__':108if __name__ == '__main__':
109 import sys, pytest109 from _tools import run_module_suite
110 pytest.main(sys.argv)110 run_module_suite()
python/tests/test_midi2note.py+2−2
@@ -40,5 +40,5 @@ class Test_midi2note_wrong_values(object): · 39 unmodified lines
40 assert_raises(TypeError, midi2note, "a")40 assert_raises(TypeError, midi2note, "a")
41 41
42if __name__ == '__main__':42if __name__ == '__main__':
43 import sys, pytest43 from _tools import run_module_suite
44 pytest.main(sys.argv)44 run_module_suite()
python/tests/test_note2midi.py+2−2
@@ -138,5 +138,5 @@ class note2freq_simple_test(TestCase): · 137 unmodified lines
138 self.assertLess(abs(note2freq("A4")-440), 1.e-12)138 self.assertLess(abs(note2freq("A4")-440), 1.e-12)
139 139
140if __name__ == '__main__':140if __name__ == '__main__':
141 import sys, pytest141 from _tools import run_module_suite
142 pytest.main(sys.argv)142 run_module_suite()
python/tests/test_sink.py+2−2
@@ -118,5 +118,5 @@ class Test_aubio_sink(object): · 117 unmodified lines
118 g(vec, 128)118 g(vec, 128)
119 119
120if __name__ == '__main__':120if __name__ == '__main__':
121 import pytest, sys121 from _tools import run_module_suite
122 pytest.main(sys.argv)122 run_module_suite()
python/tests/test_source.py+2−2
@@ -187,5 +187,5 @@ class Test_aubio_source_with(object): · 186 unmodified lines
187 assert_equal(total_frames, input_source.duration)187 assert_equal(total_frames, input_source.duration)
188 188
189if __name__ == '__main__':189if __name__ == '__main__':
190 import sys, pytest190 from _tools import run_module_suite
191 pytest.main(sys.argv)191 run_module_suite()

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