diff options
author | Julian Taylor <juliantaylor108@gmail.com> | 2014-06-30 19:32:15 +0200 |
---|---|---|
committer | Julian Taylor <juliantaylor108@gmail.com> | 2014-06-30 19:32:15 +0200 |
commit | 4e3a24bb57909d9fb678c1a16e3baf414202f229 (patch) | |
tree | c08f981045900b8762474eabc248c57e70c427bc /numpy/lib | |
parent | 49c30fd5b8c0807820d01363db43bdbbc49053ec (diff) | |
parent | 6efd8493f8b491557a34dbbc176565b759f89b52 (diff) | |
download | numpy-4e3a24bb57909d9fb678c1a16e3baf414202f229.tar.gz |
Merge pull request #4828 from ogrisel/fix-isfileobj-py3
FIX isfileobj accepts write-mode files under PY3
Diffstat (limited to 'numpy/lib')
-rw-r--r-- | numpy/lib/tests/test_io.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py index 49ad1ba5b..03e238261 100644 --- a/numpy/lib/tests/test_io.py +++ b/numpy/lib/tests/test_io.py @@ -4,9 +4,7 @@ import sys import gzip import os import threading -import shutil -import contextlib -from tempfile import mkstemp, mkdtemp, NamedTemporaryFile +from tempfile import mkstemp, NamedTemporaryFile import time import warnings import gc @@ -24,13 +22,7 @@ from numpy.ma.testutils import ( assert_raises, assert_raises_regex, run_module_suite ) from numpy.testing import assert_warns, assert_, build_err_msg - - -@contextlib.contextmanager -def tempdir(change_dir=False): - tmpdir = mkdtemp() - yield tmpdir - shutil.rmtree(tmpdir) +from numpy.testing.utils import tempdir class TextIO(BytesIO): @@ -202,7 +194,7 @@ class TestSavezLoad(RoundtripTest, TestCase): def test_big_arrays(self): L = (1 << 31) + 100000 a = np.empty(L, dtype=np.uint8) - with tempdir() as tmpdir: + with tempdir(prefix="numpy_test_big_arrays_") as tmpdir: tmp = os.path.join(tmpdir, "file.npz") np.savez(tmp, a=a) del a @@ -311,7 +303,7 @@ class TestSavezLoad(RoundtripTest, TestCase): # Check that zipfile owns file and can close it. # This needs to pass a file name to load for the # test. - with tempdir() as tmpdir: + with tempdir(prefix="numpy_test_closing_zipfile_after_load_") as tmpdir: fd, tmp = mkstemp(suffix='.npz', dir=tmpdir) os.close(fd) np.savez(tmp, lab='place holder') |