shithub: aubio

Download patch

ref: 73184852185f7d9f9770f220b309a021c21c288c
parent: 9a1df7f7457238eaaf82600d763c0104799a7c57
author: Paul Brossier <piem@piem.org>
date: Fri Nov 2 14:01:52 EDT 2018

[py] remove nose2

--- a/python/tests/_tools.py
+++ b/python/tests/_tools.py
@@ -2,40 +2,30 @@
 This file imports test methods from different testing modules, in this
 order:
 
-    - if 'nose2' is found in the list of loaded module, use it
-    - otherwise, try using 'pytest'
-    - if that also fails, fallback to 'numpy.testing'
+    - try importing 'pytest'
+    - if it fails, fallback to 'numpy.testing'
+
+Nose2 support was removed because of lacking assertWarns on py2.7.
+
 """
 
 import sys
 
 _has_pytest = False
-_has_nose2 = False
 
-# if nose2 has already been imported, use it
-if 'nose2' in sys.modules:
-    from nose2.tools import params, such
-    def parametrize(argnames, argvalues):
-        return params(*argvalues)
-    assert_raises = such.helper.assertRaises
-    assert_warns = such.helper.assertWarns
-    skipTest = such.helper.skipTest
-    _has_nose2 = True
+# check if we have pytest
+try:
+    import pytest
+    parametrize = pytest.mark.parametrize
+    assert_raises = pytest.raises
+    assert_warns = pytest.warns
+    skipTest = pytest.skip
+    _has_pytest = True
+except:
+    pass
 
-# otherwise, check if we have pytest
-if not _has_nose2:
-    try:
-        import pytest
-        parametrize = pytest.mark.parametrize
-        assert_raises = pytest.raises
-        assert_warns = pytest.warns
-        skipTest = pytest.skip
-        _has_pytest = True
-    except:
-        pass
-
 # otherwise fallback on numpy.testing
-if not _has_pytest and not _has_nose2:
+if not _has_pytest:
     from numpy.testing import dec, assert_raises, assert_warns
     from numpy.testing import SkipTest
     parametrize = dec.parametrize