shithub: aubio

Download patch

ref: 319edae161abb49fb75c7e6650685b3e7831e940
parent: 48a0e5a17b7f22e9d8c6fa37ac7e785e32811401
author: Paul Brossier <piem@piem.org>
date: Wed Oct 31 22:53:33 EDT 2018

[tests] avoid some imports, move main to end

--- a/python/tests/test_fft.py
+++ b/python/tests/test_fft.py
@@ -1,6 +1,5 @@
 #! /usr/bin/env python
 
-from unittest import main
 from numpy.testing import TestCase
 from numpy.testing import assert_equal, assert_almost_equal
 import numpy as np
@@ -192,4 +191,5 @@
             fft(win_s)
 
 if __name__ == '__main__':
+    from unittest import main
     main()
--- a/python/tests/test_filter.py
+++ b/python/tests/test_filter.py
@@ -1,6 +1,5 @@
 #! /usr/bin/env python
 
-from unittest import main
 from numpy.testing import TestCase, assert_equal, assert_almost_equal
 from aubio import fvec, digital_filter
 from .utils import array_from_text_file
@@ -84,4 +83,5 @@
             digital_filter(-1)
 
 if __name__ == '__main__':
+    from unittest import main
     main()
--- a/python/tests/test_filterbank.py
+++ b/python/tests/test_filterbank.py
@@ -87,5 +87,5 @@
             f(cvec(256))
 
 if __name__ == '__main__':
-    import nose2
-    nose2.main()
+    from unittest import main
+    main()
--- a/python/tests/test_filterbank_mel.py
+++ b/python/tests/test_filterbank_mel.py
@@ -48,5 +48,5 @@
                     0.02133301, 0.02133301, 0.02133311, 0.02133334, 0.02133345])
 
 if __name__ == '__main__':
-    import nose2
-    nose2.main()
+    from unittest import main
+    main()
--- a/python/tests/test_fvec_shift.py
+++ b/python/tests/test_fvec_shift.py
@@ -30,6 +30,6 @@
     def test_can_shift_fvec_odd(self):
         self.run_shift_ishift(7)
 
-from unittest import main
 if __name__ == '__main__':
+    from unittest import main
     main()
--- a/python/tests/test_mathutils.py
+++ b/python/tests/test_mathutils.py
@@ -1,6 +1,5 @@
 #! /usr/bin/env python
 
-from unittest import main
 from numpy.testing import TestCase, assert_equal
 from numpy import array, arange, isnan, isinf
 from aubio import bintomidi, miditobin, freqtobin, bintofreq, freqtomidi, miditofreq
@@ -101,4 +100,5 @@
         assert_equal ( array(b) < 0, False )
 
 if __name__ == '__main__':
+    from unittest import main
     main()
--- a/python/tests/test_musicutils.py
+++ b/python/tests/test_musicutils.py
@@ -1,6 +1,5 @@
 #! /usr/bin/env python
 
-from unittest import main
 import numpy as np
 from numpy.testing import TestCase
 from numpy.testing.utils import assert_equal, assert_almost_equal
@@ -85,4 +84,5 @@
         assert level_detection(ones(1024, dtype = float_type), -70) == 0
 
 if __name__ == '__main__':
+    from unittest import main
     main()
--- a/python/tests/test_onset.py
+++ b/python/tests/test_onset.py
@@ -1,6 +1,5 @@
 #! /usr/bin/env python
 
-from unittest import main
 from numpy.testing import TestCase, assert_equal, assert_almost_equal
 from aubio import onset
 
@@ -84,4 +83,5 @@
     samplerate = 8000
 
 if __name__ == '__main__':
+    from unittest import main
     main()