summaryrefslogtreecommitdiff
path: root/numpy/testing/utils.py
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2016-08-06 23:15:40 +0300
committermattip <matti.picus@gmail.com>2016-08-15 19:46:41 +0300
commit76eff9ca4648e96ba1f560e83f40383f68805493 (patch)
treefd6fb98bd46416ed561ecbf3c39b9c44cf2bce18 /numpy/testing/utils.py
parent0fc9e4520b1d00b58a77f28936da2fec2672de83 (diff)
downloadnumpy-76eff9ca4648e96ba1f560e83f40383f68805493.tar.gz
ENH: skip or avoid gc/objectmodel differences btwn pypy and cpython
Diffstat (limited to 'numpy/testing/utils.py')
-rw-r--r--numpy/testing/utils.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py
index dc1115e1b..176d87800 100644
--- a/numpy/testing/utils.py
+++ b/numpy/testing/utils.py
@@ -32,7 +32,8 @@ __all__ = ['assert_equal', 'assert_almost_equal', 'assert_approx_equal',
'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',
- 'SkipTest', 'KnownFailureException', 'temppath', 'tempdir']
+ 'SkipTest', 'KnownFailureException', 'temppath', 'tempdir', 'IS_PYPY',
+ 'HAS_REFCOUNT']
class KnownFailureException(Exception):
@@ -43,6 +44,8 @@ class KnownFailureException(Exception):
KnownFailureTest = KnownFailureException # backwards compat
verbose = 0
+IS_PYPY = '__pypy__' in sys.modules
+HAS_REFCOUNT = getattr(sys, 'getrefcount', None) is not None
def assert_(val, msg=''):
"""
@@ -1274,6 +1277,8 @@ def _assert_valid_refcount(op):
Check that ufuncs don't mishandle refcount of object `1`.
Used in a few regression tests.
"""
+ if not HAS_REFCOUNT:
+ return True
import numpy as np
b = np.arange(100*100).reshape(100, 100)