summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2018-04-21 21:05:58 -0600
committerGitHub <noreply@github.com>2018-04-21 21:05:58 -0600
commitb5c1bcf1e8ef6e9c11bb4138a15286e648fcbce0 (patch)
tree62cd661d640647bfd210682cf0ce8d553ef69d09 /numpy/lib/tests
parente0b5e8740efe6d42c909c1374494e614592c65ab (diff)
parent3ff0c5c82b8abc4c94b1801a13f488778631f38a (diff)
downloadnumpy-b5c1bcf1e8ef6e9c11bb4138a15286e648fcbce0.tar.gz
Merge pull request #10891 from eric-wieser/assert-no-cycles
TST: Extract a helper function to test for reference cycles
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r--numpy/lib/tests/test_io.py13
1 files changed, 2 insertions, 11 deletions
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py
index 84aca9915..0ce44f28b 100644
--- a/numpy/lib/tests/test_io.py
+++ b/numpy/lib/tests/test_io.py
@@ -23,7 +23,7 @@ from numpy.ma.testutils import assert_equal
from numpy.testing import (
assert_warns, assert_, SkipTest, assert_raises_regex, assert_raises,
assert_allclose, assert_array_equal, temppath, tempdir, IS_PYPY,
- HAS_REFCOUNT, suppress_warnings,
+ HAS_REFCOUNT, suppress_warnings, assert_no_gc_cycles,
)
@@ -2416,14 +2416,5 @@ def test_load_refcount():
np.savez(f, [1, 2, 3])
f.seek(0)
- assert_(gc.isenabled())
- gc.disable()
- try:
- gc.collect()
+ with assert_no_gc_cycles():
np.load(f)
- # gc.collect returns the number of unreachable objects in cycles that
- # were found -- we are checking that no cycles were created by np.load
- n_objects_in_cycles = gc.collect()
- finally:
- gc.enable()
- assert_equal(n_objects_in_cycles, 0)