summaryrefslogtreecommitdiff
path: root/numpy/testing/tests
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2023-01-18 17:04:13 -0700
committerCharles Harris <charlesr.harris@gmail.com>2023-01-19 14:35:44 -0700
commitf75bb0edb0e6eec2564de4bf798242984860a19b (patch)
tree147d9a0804a8d0afb8d409d8f0595b688be3f5f6 /numpy/testing/tests
parentb2badd70786145eb21cec02109b23e6520c6ffea (diff)
downloadnumpy-f75bb0edb0e6eec2564de4bf798242984860a19b.tar.gz
MAINT: Remove all nose testing support.
NumPy switched to using pytest in 2018 and nose has been unmaintained for many years. We have kept NumPy's nose support to avoid breaking downstream projects who might have been using it and not yet switched to pytest or some other testing framework. With the arrival of Python 3.12, unpatched nose will raise an error. It it time to move on. Decorators removed - raises - slow - setastest - skipif - knownfailif - deprecated - parametrize - _needs_refcount These are not to be confused with pytest versions with similar names, e.g., pytest.mark.slow, pytest.mark.skipif, pytest.mark.parametrize. Functions removed - Tester - import_nose - run_module_suite
Diffstat (limited to 'numpy/testing/tests')
-rw-r--r--numpy/testing/tests/test_doctesting.py57
-rw-r--r--numpy/testing/tests/test_utils.py37
2 files changed, 1 insertions, 93 deletions
diff --git a/numpy/testing/tests/test_doctesting.py b/numpy/testing/tests/test_doctesting.py
deleted file mode 100644
index 92c2156d8..000000000
--- a/numpy/testing/tests/test_doctesting.py
+++ /dev/null
@@ -1,57 +0,0 @@
-""" Doctests for NumPy-specific nose/doctest modifications
-
-"""
-#FIXME: None of these tests is run, because 'check' is not a recognized
-# testing prefix.
-
-# try the #random directive on the output line
-def check_random_directive():
- '''
- >>> 2+2
- <BadExample object at 0x084D05AC> #random: may vary on your system
- '''
-
-# check the implicit "import numpy as np"
-def check_implicit_np():
- '''
- >>> np.array([1,2,3])
- array([1, 2, 3])
- '''
-
-# there's some extraneous whitespace around the correct responses
-def check_whitespace_enabled():
- '''
- # whitespace after the 3
- >>> 1+2
- 3
-
- # whitespace before the 7
- >>> 3+4
- 7
- '''
-
-def check_empty_output():
- """ Check that no output does not cause an error.
-
- This is related to nose bug 445; the numpy plugin changed the
- doctest-result-variable default and therefore hit this bug:
- http://code.google.com/p/python-nose/issues/detail?id=445
-
- >>> a = 10
- """
-
-def check_skip():
- """ Check skip directive
-
- The test below should not run
-
- >>> 1/0 #doctest: +SKIP
- """
-
-
-if __name__ == '__main__':
- # Run tests outside numpy test rig
- import nose
- from numpy.testing.noseclasses import NumpyDoctest
- argv = ['', __file__, '--with-numpydoctest']
- nose.core.TestProgram(argv=argv, addplugins=[NumpyDoctest()])
diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py
index 052cc3aa1..8f4912fab 100644
--- a/numpy/testing/tests/test_utils.py
+++ b/numpy/testing/tests/test_utils.py
@@ -8,7 +8,7 @@ import weakref
import numpy as np
from numpy.testing import (
assert_equal, assert_array_equal, assert_almost_equal,
- assert_array_almost_equal, assert_array_less, build_err_msg, raises,
+ assert_array_almost_equal, assert_array_less, build_err_msg,
assert_raises, assert_warns, assert_no_warnings, assert_allclose,
assert_approx_equal, assert_array_almost_equal_nulp, assert_array_max_ulp,
clear_and_catch_warnings, suppress_warnings, assert_string_equal, assert_,
@@ -793,41 +793,6 @@ class TestArrayAssertLess:
self._assert_func(-ainf, x)
-@pytest.mark.skip(reason="The raises decorator depends on Nose")
-class TestRaises:
-
- def setup_method(self):
- class MyException(Exception):
- pass
-
- self.e = MyException
-
- def raises_exception(self, e):
- raise e
-
- def does_not_raise_exception(self):
- pass
-
- def test_correct_catch(self):
- raises(self.e)(self.raises_exception)(self.e) # raises?
-
- def test_wrong_exception(self):
- try:
- raises(self.e)(self.raises_exception)(RuntimeError) # raises?
- except RuntimeError:
- return
- else:
- raise AssertionError("should have caught RuntimeError")
-
- def test_catch_no_raise(self):
- try:
- raises(self.e)(self.does_not_raise_exception)() # raises?
- except AssertionError:
- return
- else:
- raise AssertionError("should have raised an AssertionError")
-
-
class TestWarns:
def test_warn(self):