summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_io.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/tests/test_io.py')
-rw-r--r--numpy/lib/tests/test_io.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py
index 8995fad64..a8b578097 100644
--- a/numpy/lib/tests/test_io.py
+++ b/numpy/lib/tests/test_io.py
@@ -295,13 +295,14 @@ 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.
- fd, tmp = mkstemp(suffix='.npz')
- os.close(fd)
- np.savez(tmp, lab='place holder')
- data = np.load(tmp)
- fp = data.zip.fp
- data.close()
- assert_(fp.closed)
+ with tempdir() as tmpdir:
+ fd, tmp = mkstemp(suffix='.npz', dir=tmpdir)
+ os.close(fd)
+ np.savez(tmp, lab='place holder')
+ data = np.load(tmp)
+ fp = data.zip.fp
+ data.close()
+ assert_(fp.closed)
class TestSaveTxt(TestCase):