summaryrefslogtreecommitdiff
path: root/numpy/core/tests
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/tests')
-rw-r--r--numpy/core/tests/test_arrayprint.py3
-rw-r--r--numpy/core/tests/test_indexing.py16
-rw-r--r--numpy/core/tests/test_nditer.py2
-rw-r--r--numpy/core/tests/test_numeric.py4
-rw-r--r--numpy/core/tests/test_regression.py8
5 files changed, 10 insertions, 23 deletions
diff --git a/numpy/core/tests/test_arrayprint.py b/numpy/core/tests/test_arrayprint.py
index 309df8545..6c2403e67 100644
--- a/numpy/core/tests/test_arrayprint.py
+++ b/numpy/core/tests/test_arrayprint.py
@@ -5,7 +5,7 @@ import sys, gc
import numpy as np
from numpy.testing import (
- run_module_suite, assert_, assert_equal, assert_raises, assert_warns, dec
+ run_module_suite, assert_, assert_equal, assert_raises, assert_warns, dec,
)
import textwrap
@@ -388,6 +388,7 @@ class TestArray2String(object):
"[ 'xxxxx']"
)
+ @dec._needs_refcount
def test_refcount(self):
# make sure we do not hold references to the array due to a recursive
# closure (gh-10620)
diff --git a/numpy/core/tests/test_indexing.py b/numpy/core/tests/test_indexing.py
index cd4ea611a..26882c593 100644
--- a/numpy/core/tests/test_indexing.py
+++ b/numpy/core/tests/test_indexing.py
@@ -14,20 +14,6 @@ from numpy.testing import (
)
-try:
- cdll = None
- if hasattr(sys, 'gettotalrefcount'):
- try:
- cdll = np.ctypeslib.load_library('multiarray_d', np.core.multiarray.__file__)
- except OSError:
- pass
- if cdll is None:
- cdll = np.ctypeslib.load_library('multiarray', np.core.multiarray.__file__)
- _HAS_CTYPE = True
-except ImportError:
- _HAS_CTYPE = False
-
-
class TestIndexing(object):
def test_index_no_floats(self):
a = np.array([[[5]]])
@@ -622,7 +608,7 @@ class TestSubclasses(object):
assert_array_equal(new_s.finalize_status, new_s)
assert_array_equal(new_s.old, s)
- @dec.skipif(not HAS_REFCOUNT)
+ @dec._needs_refcount
def test_slice_decref_getsetslice(self):
# See gh-10066, a temporary slice object should be discarted.
# This test is only really interesting on Python 2 since
diff --git a/numpy/core/tests/test_nditer.py b/numpy/core/tests/test_nditer.py
index f3f8706b5..1b2485a87 100644
--- a/numpy/core/tests/test_nditer.py
+++ b/numpy/core/tests/test_nditer.py
@@ -33,7 +33,7 @@ def iter_iterindices(i):
i.iternext()
return ret
-@dec.skipif(not HAS_REFCOUNT, "python does not have sys.getrefcount")
+@dec._needs_refcount
def test_iter_refcount():
# Make sure the iterator doesn't leak
diff --git a/numpy/core/tests/test_numeric.py b/numpy/core/tests/test_numeric.py
index 7c012e9e8..d7cdd77f1 100644
--- a/numpy/core/tests/test_numeric.py
+++ b/numpy/core/tests/test_numeric.py
@@ -12,7 +12,7 @@ from numpy.random import rand, randint, randn
from numpy.testing import (
run_module_suite, assert_, assert_equal, assert_raises,
assert_raises_regex, assert_array_equal, assert_almost_equal,
- assert_array_almost_equal, dec, HAS_REFCOUNT, suppress_warnings
+ assert_array_almost_equal, dec, suppress_warnings
)
@@ -2092,7 +2092,7 @@ class TestCreationFuncs(object):
self.check_function(np.full, 0)
self.check_function(np.full, 1)
- @dec.skipif(not HAS_REFCOUNT, "python has no sys.getrefcount")
+ @dec._needs_refcount
def test_for_reference_leak(self):
# Make sure we have an object for reference
dim = 1
diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py
index a3b011454..016b720f3 100644
--- a/numpy/core/tests/test_regression.py
+++ b/numpy/core/tests/test_regression.py
@@ -1424,7 +1424,7 @@ class TestRegression(object):
x[x.nonzero()] = x.ravel()[:1]
assert_(x[0, 1] == x[0, 0])
- @dec.skipif(not HAS_REFCOUNT, "python has no sys.getrefcount")
+ @dec._needs_refcount
def test_structured_arrays_with_objects2(self):
# Ticket #1299 second test
stra = 'aaaa'
@@ -1537,7 +1537,7 @@ class TestRegression(object):
y = np.add(x, x, x)
assert_equal(id(x), id(y))
- @dec.skipif(not HAS_REFCOUNT, "python has no sys.getrefcount")
+ @dec._needs_refcount
def test_take_refcount(self):
# ticket #939
a = np.arange(16, dtype=float)
@@ -1937,7 +1937,7 @@ class TestRegression(object):
a = np.empty((100000000,), dtype='i1')
del a
- @dec.skipif(not HAS_REFCOUNT, "python has no sys.getrefcount")
+ @dec._needs_refcount
def test_ufunc_reduce_memoryleak(self):
a = np.arange(6)
acnt = sys.getrefcount(a)
@@ -2167,7 +2167,7 @@ class TestRegression(object):
assert_equal(uf(a), ())
assert_array_equal(a, [[3, 2, 1], [5, 4], [9, 7, 8, 6]])
- @dec.skipif(not HAS_REFCOUNT, "python has no sys.getrefcount")
+ @dec._needs_refcount
def test_leak_in_structured_dtype_comparison(self):
# gh-6250
recordtype = np.dtype([('a', np.float64),