diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2018-04-21 21:05:58 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-21 21:05:58 -0600 |
commit | b5c1bcf1e8ef6e9c11bb4138a15286e648fcbce0 (patch) | |
tree | 62cd661d640647bfd210682cf0ce8d553ef69d09 /numpy/lib/tests | |
parent | e0b5e8740efe6d42c909c1374494e614592c65ab (diff) | |
parent | 3ff0c5c82b8abc4c94b1801a13f488778631f38a (diff) | |
download | numpy-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.py | 13 |
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) |