summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
diff options
context:
space:
mode:
authorMatthias C. M. Troffaes <matthias.troffaes@gmail.com>2015-11-05 11:37:02 +0000
committerMatthias C. M. Troffaes <matthias.troffaes@gmail.com>2016-09-08 11:48:19 +0100
commita3db73a8b2f53b0602b1aadd31c48836c07b82dc (patch)
treed81997e66439fa6c7471e0a021d4152e638425eb /numpy/lib/tests
parentcb7f4078bf94cde6233b9128f138ba18e04c1d1d (diff)
downloadnumpy-a3db73a8b2f53b0602b1aadd31c48836c07b82dc.tar.gz
BUG: npy_PyFile_Dup2 - fix PyFile_AsFile failing on io style classes
This bug only manifests itself in the Python 2 code path. Falls back to the current Python 3 code path also on Python 2 because the Python 3 code path is written precisely to handle this situation. Also fix tests, and clarify in the documentation that the current implementation requires the stream to be seekable.
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r--numpy/lib/tests/test_io.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py
index 333891d46..88a3fbbbb 100644
--- a/numpy/lib/tests/test_io.py
+++ b/numpy/lib/tests/test_io.py
@@ -103,8 +103,9 @@ class RoundtripTest(object):
if not isinstance(target_file, BytesIO):
target_file.close()
# holds an open file descriptor so it can't be deleted on win
- if not isinstance(arr_reloaded, np.lib.npyio.NpzFile):
- os.remove(target_file.name)
+ if 'arr_reloaded' in locals():
+ if not isinstance(arr_reloaded, np.lib.npyio.NpzFile):
+ os.remove(target_file.name)
def check_roundtrips(self, a):
self.roundtrip(a)