Skip to content

Commit 9aeb751

Browse files
authored
Merge pull request numpy#14921 from mattip/coverage-refcount
TST: add no_tracing decorator to refcount-sensitive codepath tests
2 parents b2b45fe + f48d2c9 commit 9aeb751

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ matrix:
5858
- python3-dbg
5959
- python3-dev
6060
- python3-setuptools
61-
- python: 3.6
61+
- python: 3.7
6262
env: USE_WHEEL=1 RUN_FULL_TESTS=1 RUN_COVERAGE=1 INSTALL_PICKLE5=1
6363
- python: 3.6
6464
env: USE_SDIST=1

numpy/core/tests/test_multiarray.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import weakref
2121
import pytest
2222
from contextlib import contextmanager
23+
from test.support import no_tracing
2324

2425
from numpy.compat import pickle
2526

@@ -5119,6 +5120,8 @@ def test_refcount(self):
51195120

51205121

51215122
class TestResize(object):
5123+
5124+
@no_tracing
51225125
def test_basic(self):
51235126
x = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
51245127
if IS_PYPY:
@@ -5135,6 +5138,7 @@ def test_check_reference(self):
51355138
assert_raises(ValueError, x.resize, (5, 1))
51365139
del y # avoid pyflakes unused variable warning.
51375140

5141+
@no_tracing
51385142
def test_int_shape(self):
51395143
x = np.eye(3)
51405144
if IS_PYPY:
@@ -5168,6 +5172,7 @@ def test_invalid_arguments(self):
51685172
assert_raises(TypeError, np.eye(3).resize, order=1)
51695173
assert_raises(TypeError, np.eye(3).resize, refcheck='hi')
51705174

5175+
@no_tracing
51715176
def test_freeform_shape(self):
51725177
x = np.eye(3)
51735178
if IS_PYPY:
@@ -5176,6 +5181,7 @@ def test_freeform_shape(self):
51765181
x.resize(3, 2, 1)
51775182
assert_(x.shape == (3, 2, 1))
51785183

5184+
@no_tracing
51795185
def test_zeros_appended(self):
51805186
x = np.eye(3)
51815187
if IS_PYPY:
@@ -5185,6 +5191,7 @@ def test_zeros_appended(self):
51855191
assert_array_equal(x[0], np.eye(3))
51865192
assert_array_equal(x[1], np.zeros((3, 3)))
51875193

5194+
@no_tracing
51885195
def test_obj_obj(self):
51895196
# check memory is initialized on resize, gh-4857
51905197
a = np.ones(10, dtype=[('k', object, 2)])
@@ -7796,6 +7803,7 @@ def test_reshape(self):
77967803
d = np.ones(100)
77977804
assert_(sys.getsizeof(d) < sys.getsizeof(d.reshape(100, 1, 1).copy()))
77987805

7806+
@no_tracing
77997807
def test_resize(self):
78007808
d = np.ones(100)
78017809
old = sys.getsizeof(d)

numpy/core/tests/test_regression.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
_assert_valid_refcount, HAS_REFCOUNT,
1818
)
1919
from numpy.compat import asbytes, asunicode, long, pickle
20+
from test.support import no_tracing
2021

2122
try:
2223
RecursionError
@@ -1316,6 +1317,7 @@ def test_void_scalar_constructor(self):
13161317
assert_(pickle.loads(
13171318
pickle.dumps(test_record, protocol=proto)) == test_record)
13181319

1320+
@no_tracing
13191321
def test_blasdot_uninitialized_memory(self):
13201322
# Ticket #950
13211323
for m in [0, 1, 2]:

0 commit comments

Comments
 (0)