[pypy-commit] pypy py3k: Tweak test_fileio.py, just like version 2.7.

amauryfa noreply at buildbot.pypy.org
Mon Nov 5 22:50:31 CET 2012


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3k
Changeset: r58752:acbed198f8af
Date: 2012-10-27 00:52 +0200
http://bitbucket.org/pypy/pypy/changeset/acbed198f8af/

Log:	Tweak test_fileio.py, just like version 2.7.

diff --git a/lib-python/3.2/test/test_fileio.py b/lib-python/3.2/test/test_fileio.py
--- a/lib-python/3.2/test/test_fileio.py
+++ b/lib-python/3.2/test/test_fileio.py
@@ -9,6 +9,7 @@
 from functools import wraps
 
 from test.support import TESTFN, check_warnings, run_unittest, make_bad_fd
+from test.support import gc_collect
 
 from _io import FileIO as _FileIO
 
@@ -30,6 +31,7 @@
         self.assertEqual(self.f.tell(), p.tell())
         self.f.close()
         self.f = None
+        gc_collect()
         self.assertRaises(ReferenceError, getattr, p, 'tell')
 
     def testSeekTell(self):
@@ -103,8 +105,8 @@
         self.assertTrue(f.closed)
 
     def testMethods(self):
-        methods = ['fileno', 'isatty', 'read', 'readinto',
-                   'seek', 'tell', 'truncate', 'write', 'seekable',
+        methods = ['fileno', 'isatty', 'read',
+                   'tell', 'truncate', 'seekable',
                    'readable', 'writable']
 
         self.f.close()
@@ -114,6 +116,10 @@
             method = getattr(self.f, methodname)
             # should raise on closed file
             self.assertRaises(ValueError, method)
+        # methods with one argument
+        self.assertRaises(ValueError, self.f.readinto, 0)
+        self.assertRaises(ValueError, self.f.write, 0)
+        self.assertRaises(ValueError, self.f.seek, 0)
 
     def testOpendir(self):
         # Issue 3703: opening a directory should fill the errno


More information about the pypy-commit mailing list