[pypy-commit] pypy default: Port the test from 2b5071286e03 here as well, in case we decide

arigo noreply at buildbot.pypy.org
Thu Oct 30 19:27:50 CET 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r74301:babb6a7ef2ed
Date: 2014-10-30 19:27 +0100
http://bitbucket.org/pypy/pypy/changeset/babb6a7ef2ed/

Log:	Port the test from 2b5071286e03 here as well, in case we decide
	later to change or drop rlib/streamio.py.

diff --git a/pypy/module/_file/test/test_file.py b/pypy/module/_file/test/test_file.py
--- a/pypy/module/_file/test/test_file.py
+++ b/pypy/module/_file/test/test_file.py
@@ -275,6 +275,24 @@
         finally:
             f.close()
 
+    def test_ignore_ioerror_in_readall_if_nonempty_result(self):
+        # this is the behavior of regular files in CPython 2.7, as
+        # well as of _io.FileIO at least in CPython 3.3.  This is
+        # *not* the behavior of _io.FileIO in CPython 3.4 or 3.5;
+        # see CPython's issue #21090.
+        try:
+            from posix import openpty, fdopen, write, close
+        except ImportError:
+            skip('no openpty on this platform')
+        read_fd, write_fd = openpty()
+        write(write_fd, 'Abc\n')
+        close(write_fd)
+        f = fdopen(read_fd)
+        s = f.read()
+        assert s == 'Abc\r\n'
+        raises(IOError, f.read)
+        f.close()
+
 
 class AppTestNonblocking(object):
     def setup_class(cls):


More information about the pypy-commit mailing list