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
2121 assert_warns = pytest.warns
2222 skipTest = pytest.skip
2323 _has_pytest = True
24+ def run_module_suite():
25+ import sys, pytest
26+ pytest.main(sys.argv)
2427 except:
2528 pass
2629
@@ -31,6 +34,7 @@ if not _has_pytest: · 4 unmodified lines
3134 parametrize = dec.parametrize
3235 def skipTest(msg):
3336 raise SkipTest(msg)
37+ from numpy.testing import run_module_suite
3438
3539 # always use numpy's assert_equal
3640 import numpy
python/tests/test_mfcc.py+2−2
@@ -106,5 +106,5 @@ class Test_aubio_mfcc_all_parameters(object): · 105 unmodified lines
106106 #print coeffs
107107
108108 if __name__ == '__main__':
109− import sys, pytest
110− pytest.main(sys.argv)
109+ from _tools import run_module_suite
110+ run_module_suite()
python/tests/test_midi2note.py+2−2
@@ -40,5 +40,5 @@ class Test_midi2note_wrong_values(object): · 39 unmodified lines
4040 assert_raises(TypeError, midi2note, "a")
4141
4242 if __name__ == '__main__':
43− import sys, pytest
44− pytest.main(sys.argv)
43+ from _tools import run_module_suite
44+ run_module_suite()
python/tests/test_note2midi.py+2−2
@@ -138,5 +138,5 @@ class note2freq_simple_test(TestCase): · 137 unmodified lines
138138 self.assertLess(abs(note2freq("A4")-440), 1.e-12)
139139
140140 if __name__ == '__main__':
141− import sys, pytest
142− pytest.main(sys.argv)
141+ from _tools import run_module_suite
142+ run_module_suite()
python/tests/test_sink.py+2−2
@@ -118,5 +118,5 @@ class Test_aubio_sink(object): · 117 unmodified lines
118118 g(vec, 128)
119119
120120 if __name__ == '__main__':
121− import pytest, sys
122− pytest.main(sys.argv)
121+ from _tools import run_module_suite
122+ run_module_suite()
python/tests/test_source.py+2−2
@@ -187,5 +187,5 @@ class Test_aubio_source_with(object): · 186 unmodified lines
187187 assert_equal(total_frames, input_source.duration)
188188
189189 if __name__ == '__main__':
190− import sys, pytest
191− pytest.main(sys.argv)
190+ from _tools import run_module_suite
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