diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2009-06-12 20:54:21 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2009-06-12 20:54:21 (GMT) |
commit | c5ae86b9d3b6e348b6d0ee77c050134749a18ccc (patch) | |
tree | f017d15795382dee5676e1bb4240879b7b52f5af /Lib | |
parent | 47a5f48006e9adaba4ada092931eec4179e8fea4 (diff) | |
download | cpython-c5ae86b9d3b6e348b6d0ee77c050134749a18ccc.zip cpython-c5ae86b9d3b6e348b6d0ee77c050134749a18ccc.tar.gz cpython-c5ae86b9d3b6e348b6d0ee77c050134749a18ccc.tar.bz2 |
Re-enable testing of builtin open() in test_bufio in test_largefile
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_bufio.py | 5 | ||||
-rw-r--r-- | Lib/test/test_largefile.py | 12 |
2 files changed, 13 insertions, 4 deletions
diff --git a/Lib/test/test_bufio.py b/Lib/test/test_bufio.py index b2c1bf8..48cc0f3 100644 --- a/Lib/test/test_bufio.py +++ b/Lib/test/test_bufio.py @@ -68,9 +68,12 @@ class CBufferSizeTest(BufferSizeTest): class PyBufferSizeTest(BufferSizeTest): open = staticmethod(pyio.open) +class BuiltinBufferSizeTest(BufferSizeTest): + open = open + def test_main(): - support.run_unittest(CBufferSizeTest, PyBufferSizeTest) + support.run_unittest(CBufferSizeTest, PyBufferSizeTest, BuiltinBufferSizeTest) if __name__ == "__main__": test_main() diff --git a/Lib/test/test_largefile.py b/Lib/test/test_largefile.py index 5335e2c..ddbcc06 100644 --- a/Lib/test/test_largefile.py +++ b/Lib/test/test_largefile.py @@ -124,20 +124,24 @@ class LargeFileTest(unittest.TestCase): newsize -= 1 f.seek(42) f.truncate(newsize) - self.assertEqual(f.tell(), newsize) # else wasn't truncated + if self.new_io: + self.assertEqual(f.tell(), newsize) # else wasn't truncated f.seek(0, 2) self.assertEqual(f.tell(), newsize) # XXX truncate(larger than true size) is ill-defined # across platform; cut it waaaaay back f.seek(0) f.truncate(1) - self.assertEqual(f.tell(), 1) # else pointer moved + if self.new_io: + self.assertEqual(f.tell(), 1) # else pointer moved f.seek(0) self.assertEqual(len(f.read()), 1) # else wasn't truncated def test_seekable(self): # Issue #5016; seekable() can return False when the current position # is negative when truncated to an int. + if not self.new_io: + self.skipTest("builtin file doesn't have seekable()") for pos in (2**31-1, 2**31, 2**31+1): with self.open(TESTFN, 'rb') as f: f.seek(pos) @@ -171,10 +175,12 @@ def test_main(): else: f.close() suite = unittest.TestSuite() - for _open, prefix in [(io.open, 'C'), (pyio.open, 'Py')]: + for _open, prefix in [(io.open, 'C'), (pyio.open, 'Py'), + (open, 'Builtin')]: class TestCase(LargeFileTest): pass TestCase.open = staticmethod(_open) + TestCase.new_io = _open is not open TestCase.__name__ = prefix + LargeFileTest.__name__ suite.addTest(TestCase('test_seek')) suite.addTest(TestCase('test_osstat')) |