From: Paul Brossier Date: Thu, 1 Nov 2018 01:53:33 +0000 (+0100) Subject: [tests] avoid some imports, move main to end X-Git-Tag: 0.4.9~71^2~51 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=319edae161abb49fb75c7e6650685b3e7831e940;p=aubio.git [tests] avoid some imports, move main to end --- diff --git a/python/tests/test_fft.py b/python/tests/test_fft.py index a8f82b9c..5b34411f 100755 --- 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 @@ class aubio_fft_wrong_params(TestCase): fft(win_s) if __name__ == '__main__': + from unittest import main main() diff --git a/python/tests/test_filter.py b/python/tests/test_filter.py index 6a7a0ded..fc222ccb 100755 --- 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 @@ class aubio_filter_wrong_params(TestCase): digital_filter(-1) if __name__ == '__main__': + from unittest import main main() diff --git a/python/tests/test_filterbank.py b/python/tests/test_filterbank.py index 8808ba80..5cf28a25 100755 --- a/python/tests/test_filterbank.py +++ b/python/tests/test_filterbank.py @@ -87,5 +87,5 @@ class aubio_filterbank_wrong_values(TestCase): f(cvec(256)) if __name__ == '__main__': - import nose2 - nose2.main() + from unittest import main + main() diff --git a/python/tests/test_filterbank_mel.py b/python/tests/test_filterbank_mel.py index a45dbf07..81b9fd0e 100755 --- a/python/tests/test_filterbank_mel.py +++ b/python/tests/test_filterbank_mel.py @@ -48,5 +48,5 @@ class aubio_filterbank_mel_test_case(TestCase): 0.02133301, 0.02133301, 0.02133311, 0.02133334, 0.02133345]) if __name__ == '__main__': - import nose2 - nose2.main() + from unittest import main + main() diff --git a/python/tests/test_fvec_shift.py b/python/tests/test_fvec_shift.py index 929fd565..c7a03154 100644 --- a/python/tests/test_fvec_shift.py +++ b/python/tests/test_fvec_shift.py @@ -30,6 +30,6 @@ class aubio_shift_test_case(TestCase): def test_can_shift_fvec_odd(self): self.run_shift_ishift(7) -from unittest import main if __name__ == '__main__': + from unittest import main main() diff --git a/python/tests/test_mathutils.py b/python/tests/test_mathutils.py index f68fb110..ee68966c 100755 --- 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 @@ class aubio_mathutils(TestCase): assert_equal ( array(b) < 0, False ) if __name__ == '__main__': + from unittest import main main() diff --git a/python/tests/test_musicutils.py b/python/tests/test_musicutils.py index dd54abb3..04c691fd 100755 --- 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 @@ class aubio_level_detection(TestCase): assert level_detection(ones(1024, dtype = float_type), -70) == 0 if __name__ == '__main__': + from unittest import main main() diff --git a/python/tests/test_onset.py b/python/tests/test_onset.py index 8b5f7ba3..08343e20 100755 --- 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 @@ class aubio_onset_8000(aubio_onset_params): samplerate = 8000 if __name__ == '__main__': + from unittest import main main()