diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2023-01-18 17:04:13 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2023-01-19 14:35:44 -0700 |
commit | f75bb0edb0e6eec2564de4bf798242984860a19b (patch) | |
tree | 147d9a0804a8d0afb8d409d8f0595b688be3f5f6 /numpy/testing/_private/utils.py | |
parent | b2badd70786145eb21cec02109b23e6520c6ffea (diff) | |
download | numpy-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/_private/utils.py')
-rw-r--r-- | numpy/testing/_private/utils.py | 61 |
1 files changed, 1 insertions, 60 deletions
diff --git a/numpy/testing/_private/utils.py b/numpy/testing/_private/utils.py index 2a2126503..351bd2a81 100644 --- a/numpy/testing/_private/utils.py +++ b/numpy/testing/_private/utils.py @@ -29,7 +29,7 @@ __all__ = [ 'assert_array_equal', 'assert_array_less', 'assert_string_equal', 'assert_array_almost_equal', 'assert_raises', 'build_err_msg', 'decorate_methods', 'jiffies', 'memusage', 'print_assert_equal', - 'raises', 'rundocs', 'runstring', 'verbose', 'measure', + 'rundocs', 'runstring', 'verbose', 'measure', 'assert_', 'assert_array_almost_equal_nulp', 'assert_raises_regex', 'assert_array_max_ulp', 'assert_warns', 'assert_no_warnings', 'assert_allclose', 'IgnoreException', 'clear_and_catch_warnings', @@ -57,28 +57,6 @@ HAS_LAPACK64 = numpy.linalg.lapack_lite._ilp64 _OLD_PROMOTION = lambda: np._get_promotion_state() == 'legacy' -def import_nose(): - """ Import nose only when needed. - """ - nose_is_good = True - minimum_nose_version = (1, 0, 0) - try: - import nose - except ImportError: - nose_is_good = False - else: - if nose.__versioninfo__ < minimum_nose_version: - nose_is_good = False - - if not nose_is_good: - msg = ('Need nose >= %d.%d.%d for tests - see ' - 'https://nose.readthedocs.io' % - minimum_nose_version) - raise ImportError(msg) - - return nose - - def assert_(val, msg=''): """ Assert that works in release mode. @@ -1305,43 +1283,6 @@ def rundocs(filename=None, raise_on_error=True): raise AssertionError("Some doctests failed:\n%s" % "\n".join(msg)) -def raises(*args): - """Decorator to check for raised exceptions. - - The decorated test function must raise one of the passed exceptions to - pass. If you want to test many assertions about exceptions in a single - test, you may want to use `assert_raises` instead. - - .. warning:: - This decorator is nose specific, do not use it if you are using a - different test framework. - - Parameters - ---------- - args : exceptions - The test passes if any of the passed exceptions is raised. - - Raises - ------ - AssertionError - - Examples - -------- - - Usage:: - - @raises(TypeError, ValueError) - def test_raises_type_error(): - raise TypeError("This test passes") - - @raises(Exception) - def test_that_fails_by_passing(): - pass - - """ - nose = import_nose() - return nose.tools.raises(*args) - # # assert_raises and assert_raises_regex are taken from unittest. # |