[pypy-commit] pypy default: fix this test: it wasn't testing what it claimed to because it was constructing

bdkearns noreply at buildbot.pypy.org
Wed Feb 13 07:33:46 CET 2013


Author: Brian Kearns <bdkearns at gmail.com>
Branch: 
Changeset: r61160:1aa187fce1db
Date: 2013-02-13 00:30 -0500
http://bitbucket.org/pypy/pypy/changeset/1aa187fce1db/

Log:	fix this test: it wasn't testing what it claimed to because it was
	constructing seekable sources for a no-seek-available test

diff --git a/rpython/rlib/test/test_streamio.py b/rpython/rlib/test/test_streamio.py
--- a/rpython/rlib/test/test_streamio.py
+++ b/rpython/rlib/test/test_streamio.py
@@ -12,18 +12,24 @@
 
 class TSource(streamio.Stream):
 
-    def __init__(self, packets):
+    def __init__(self, packets, tell=True, seek=True):
         for x in packets:
             assert x
         self.orig_packets = packets[:]
         self.packets = packets[:]
         self.pos = 0
         self.chunks = []
+        self._tell = tell
+        self._seek = seek
 
     def tell(self):
+        if not self._tell:
+            raise streamio.MyNotImplementedError
         return self.pos
 
     def seek(self, offset, whence=0):
+        if not self._seek:
+            raise streamio.MyNotImplementedError
         if whence == 1:
             offset += self.pos
         elif whence == 2:
@@ -391,7 +397,7 @@
             cases = cases[:7]      # pick some cases at random - too slow!
         def f():
             for readto, seekto, whence in cases:
-                base = TSource(self.packets)
+                base = TSource(self.packets, seek=False)
                 file = streamio.BufferingInputStream(base)
                 head = file.read(readto)
                 assert head == all[:readto]


More information about the pypy-commit mailing list