summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/_pytesttester.py1
-rw-r--r--numpy/core/tests/test_indexing.py20
-rw-r--r--numpy/core/tests/test_multiarray.py3
-rw-r--r--numpy/testing/_private/nosetester.py3
4 files changed, 3 insertions, 24 deletions
diff --git a/numpy/_pytesttester.py b/numpy/_pytesttester.py
index cbe0779da..56eb3ac67 100644
--- a/numpy/_pytesttester.py
+++ b/numpy/_pytesttester.py
@@ -164,7 +164,6 @@ class PytestTester:
# Ignore python2.7 -3 warnings
pytest_args += [
- r"-W ignore:sys\.exc_clear\(\) not supported in 3\.x:DeprecationWarning",
r"-W ignore:in 3\.x, __setslice__:DeprecationWarning",
r"-W ignore:in 3\.x, __getslice__:DeprecationWarning",
r"-W ignore:buffer\(\) not supported in 3\.x:DeprecationWarning",
diff --git a/numpy/core/tests/test_indexing.py b/numpy/core/tests/test_indexing.py
index 635c84355..56bcf0177 100644
--- a/numpy/core/tests/test_indexing.py
+++ b/numpy/core/tests/test_indexing.py
@@ -9,7 +9,7 @@ from numpy.core._multiarray_tests import array_indexing
from itertools import product
from numpy.testing import (
assert_, assert_equal, assert_raises, assert_array_equal, assert_warns,
- HAS_REFCOUNT, suppress_warnings,
+ HAS_REFCOUNT,
)
@@ -669,30 +669,16 @@ class TestSubclasses:
k[0:5]
assert_equal(k.indx, slice(0, 5))
assert_equal(sys.getrefcount(k.indx), 2)
- try:
+ with assert_raises(ValueError):
k[0:7]
- raise AssertionError
- except ValueError:
- # The exception holds a reference to the slice so clear on Py2
- if hasattr(sys, 'exc_clear'):
- with suppress_warnings() as sup:
- sup.filter(DeprecationWarning)
- sys.exc_clear()
assert_equal(k.indx, slice(0, 7))
assert_equal(sys.getrefcount(k.indx), 2)
k[0:3] = 6
assert_equal(k.indx, slice(0, 3))
assert_equal(sys.getrefcount(k.indx), 2)
- try:
+ with assert_raises(ValueError):
k[0:4] = 2
- raise AssertionError
- except ValueError:
- # The exception holds a reference to the slice so clear on Py2
- if hasattr(sys, 'exc_clear'):
- with suppress_warnings() as sup:
- sup.filter(DeprecationWarning)
- sys.exc_clear()
assert_equal(k.indx, slice(0, 4))
assert_equal(sys.getrefcount(k.indx), 2)
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py
index 67d312652..c4f136849 100644
--- a/numpy/core/tests/test_multiarray.py
+++ b/numpy/core/tests/test_multiarray.py
@@ -8240,9 +8240,6 @@ class TestArrayFinalize:
# get an array that crashed in __array_finalize__
with assert_raises(Exception) as e:
obj_arr.view(RaisesInFinalize)
- if sys.version_info.major == 2:
- # prevent an extra reference being kept
- sys.exc_clear()
obj_subarray = e.exception.args[0]
del e
diff --git a/numpy/testing/_private/nosetester.py b/numpy/testing/_private/nosetester.py
index a874321cc..73f5b3d35 100644
--- a/numpy/testing/_private/nosetester.py
+++ b/numpy/testing/_private/nosetester.py
@@ -454,9 +454,6 @@ class NoseTester:
# This is very specific, so using the fragile module filter
# is fine
import threading
- sup.filter(DeprecationWarning,
- r"sys\.exc_clear\(\) not supported in 3\.x",
- module=threading)
sup.filter(DeprecationWarning, message=r"in 3\.x, __setslice__")
sup.filter(DeprecationWarning, message=r"in 3\.x, __getslice__")
sup.filter(DeprecationWarning, message=r"buffer\(\) not supported in 3\.x")