[pypy-commit] pypy py3.5: Add a failing test. Unsure how to fix it---I can't quite follow the mess

arigo pypy.commits at gmail.com
Sat Jun 17 12:27:36 EDT 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5
Changeset: r91618:9d66d935ba76
Date: 2017-06-17 16:36 +0200
http://bitbucket.org/pypy/pypy/changeset/9d66d935ba76/

Log:	Add a failing test. Unsure how to fix it---I can't quite follow the
	mess of buffers and memoryviews for now...

diff --git a/pypy/module/_io/test/test_fileio.py b/pypy/module/_io/test/test_fileio.py
--- a/pypy/module/_io/test/test_fileio.py
+++ b/pypy/module/_io/test/test_fileio.py
@@ -5,7 +5,8 @@
 
 
 class AppTestFileIO:
-    spaceconfig = dict(usemodules=['_io'] + (['fcntl'] if os.name != 'nt' else []))
+    spaceconfig = dict(usemodules=['_io', 'array'] +
+                                  (['fcntl'] if os.name != 'nt' else []))
 
     def setup_method(self, meth):
         tmpfile = udir.join('tmpfile')
@@ -188,6 +189,14 @@
         assert f.readinto(a) == 1000
         assert a == b'a' * 1000 + b'x' * 24
 
+    def test_readinto_array(self):
+        import _io, array
+        buffer = array.array('i', [0]*10)
+        m = memoryview(buffer)
+        f = _io.FileIO(self.tmpfile, 'r+')
+        assert f.readinto(m[1:9]) == 5
+        assert buffer[1] in (0x610a620a, 0x0a620a61)
+
     def test_nonblocking_read(self):
         try:
             import os, fcntl


More information about the pypy-commit mailing list