diff options
-rw-r--r-- | numpy/core/tests/test_dtype.py | 9 | ||||
-rw-r--r-- | numpy/core/tests/test_multiarray.py | 6 | ||||
-rw-r--r-- | numpy/core/tests/test_regression.py | 6 | ||||
-rw-r--r-- | numpy/testing/__init__.py | 3 | ||||
-rw-r--r-- | numpy/testing/__init__.pyi | 1 | ||||
-rw-r--r-- | numpy/testing/_private/utils.py | 3 |
6 files changed, 22 insertions, 6 deletions
diff --git a/numpy/core/tests/test_dtype.py b/numpy/core/tests/test_dtype.py index 3d15009ea..4f52268f5 100644 --- a/numpy/core/tests/test_dtype.py +++ b/numpy/core/tests/test_dtype.py @@ -9,10 +9,12 @@ import numpy as np from numpy.core._rational_tests import rational from numpy.core._multiarray_tests import create_custom_field_dtype from numpy.testing import ( - assert_, assert_equal, assert_array_equal, assert_raises, HAS_REFCOUNT) + assert_, assert_equal, assert_array_equal, assert_raises, HAS_REFCOUNT, + IS_PYSTON) from numpy.compat import pickle from itertools import permutations + def assert_dtype_equal(a, b): assert_equal(a, b) assert_equal(hash(a), hash(b), @@ -805,12 +807,14 @@ class TestMonsterType: ('yi', np.dtype((a, (3, 2))))]) assert_dtype_equal(c, d) + @pytest.mark.skipif(IS_PYSTON, reason="Pyston disables recursion checking") def test_list_recursion(self): l = list() l.append(('f', l)) with pytest.raises(RecursionError): np.dtype(l) + @pytest.mark.skipif(IS_PYSTON, reason="Pyston disables recursion checking") def test_tuple_recursion(self): d = np.int32 for i in range(100000): @@ -818,6 +822,7 @@ class TestMonsterType: with pytest.raises(RecursionError): np.dtype(d) + @pytest.mark.skipif(IS_PYSTON, reason="Pyston disables recursion checking") def test_dict_recursion(self): d = dict(names=['self'], formats=[None], offsets=[0]) d['formats'][0] = d @@ -1239,6 +1244,7 @@ class TestFromDTypeAttribute: assert np.dtype(dt) == np.float64 assert np.dtype(dt()) == np.float64 + @pytest.mark.skipif(IS_PYSTON, reason="Pyston disables recursion checking") def test_recursion(self): class dt: pass @@ -1262,6 +1268,7 @@ class TestFromDTypeAttribute: np.dtype(dt) np.dtype(dt(1)) + @pytest.mark.skipif(IS_PYSTON, reason="Pyston disables recursion checking") def test_void_subtype_recursion(self): class vdt(np.void): pass diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py index 67e776937..7c8fc8e3e 100644 --- a/numpy/core/tests/test_multiarray.py +++ b/numpy/core/tests/test_multiarray.py @@ -25,8 +25,8 @@ from numpy.core._rational_tests import rational from numpy.testing import ( assert_, assert_raises, assert_warns, assert_equal, assert_almost_equal, assert_array_equal, assert_raises_regex, assert_array_almost_equal, - assert_allclose, IS_PYPY, HAS_REFCOUNT, assert_array_less, runstring, - temppath, suppress_warnings, break_cycles, + assert_allclose, IS_PYPY, IS_PYSTON, HAS_REFCOUNT, assert_array_less, + runstring, temppath, suppress_warnings, break_cycles, ) from numpy.testing._private.utils import _no_tracing from numpy.core.tests._locales import CommaDecimalPointLocale @@ -8113,6 +8113,8 @@ class TestConversion: assert_raises(NotImplementedError, bool, np.array(NotConvertible())) assert_raises(NotImplementedError, bool, np.array([NotConvertible()])) + if IS_PYSTON: + pytest.skip("Pyston disables recursion checking") self_containing = np.array([None]) self_containing[0] = self_containing diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py index 312d0683d..21cc8c159 100644 --- a/numpy/core/tests/test_regression.py +++ b/numpy/core/tests/test_regression.py @@ -12,7 +12,7 @@ from numpy.testing import ( assert_, assert_equal, IS_PYPY, assert_almost_equal, assert_array_equal, assert_array_almost_equal, assert_raises, assert_raises_regex, assert_warns, suppress_warnings, - _assert_valid_refcount, HAS_REFCOUNT, + _assert_valid_refcount, HAS_REFCOUNT, IS_PYSTON ) from numpy.testing._private.utils import _no_tracing, requires_memory from numpy.compat import asbytes, asunicode, pickle @@ -22,6 +22,8 @@ try: except NameError: RecursionError = RuntimeError # python < 3.5 + + class TestRegression: def test_invalid_round(self): # Ticket #3 @@ -1796,6 +1798,7 @@ class TestRegression: assert_(a.flags.f_contiguous) assert_(b.flags.c_contiguous) + @pytest.mark.skipif(IS_PYSTON, reason="Pyston disables recursion checking") def test_object_array_self_reference(self): # Object arrays with references to themselves can cause problems a = np.array(0, dtype=object) @@ -1804,6 +1807,7 @@ class TestRegression: assert_raises(RecursionError, float, a) a[()] = None + @pytest.mark.skipif(IS_PYSTON, reason="Pyston disables recursion checking") def test_object_array_circular_reference(self): # Test the same for a circular reference. a = np.array(0, dtype=object) diff --git a/numpy/testing/__init__.py b/numpy/testing/__init__.py index 064a74a16..bca1d3670 100644 --- a/numpy/testing/__init__.py +++ b/numpy/testing/__init__.py @@ -8,7 +8,8 @@ away. from unittest import TestCase from ._private.utils import * -from ._private.utils import _assert_valid_refcount, _gen_alignment_data +from ._private.utils import (_assert_valid_refcount, _gen_alignment_data, + IS_PYSTON) from ._private import decorators as dec from ._private.nosetester import ( run_module_suite, NoseTester as Tester diff --git a/numpy/testing/__init__.pyi b/numpy/testing/__init__.pyi index 955dae862..9eaba3deb 100644 --- a/numpy/testing/__init__.pyi +++ b/numpy/testing/__init__.pyi @@ -37,6 +37,7 @@ from numpy.testing._private.utils import ( temppath as temppath, tempdir as tempdir, IS_PYPY as IS_PYPY, + IS_PYSTON as IS_PYSTON, HAS_REFCOUNT as HAS_REFCOUNT, suppress_warnings as suppress_warnings, assert_array_compare as assert_array_compare, diff --git a/numpy/testing/_private/utils.py b/numpy/testing/_private/utils.py index 487aa0b4c..77ca4ef85 100644 --- a/numpy/testing/_private/utils.py +++ b/numpy/testing/_private/utils.py @@ -48,7 +48,8 @@ KnownFailureTest = KnownFailureException # backwards compat verbose = 0 IS_PYPY = platform.python_implementation() == 'PyPy' -HAS_REFCOUNT = getattr(sys, 'getrefcount', None) is not None +IS_PYSTON = hasattr(sys, "pyston_version_info") +HAS_REFCOUNT = getattr(sys, 'getrefcount', None) is not None and not IS_PYSTON HAS_LAPACK64 = numpy.linalg.lapack_lite._ilp64 |