[Python-checkins] r67908 - in python/trunk: Lib/test/test_file.py Misc/NEWS

skip.montanaro python-checkins at python.org
Tue Dec 23 04:30:15 CET 2008


Author: skip.montanaro
Date: Tue Dec 23 04:30:15 2008
New Revision: 67908

Log:
As a result of a regression that snuck into 2.5.3 add a test case that
ensures that when you try to read from a file opened for writing an IOError
is raised.


Modified:
   python/trunk/Lib/test/test_file.py
   python/trunk/Misc/NEWS

Modified: python/trunk/Lib/test/test_file.py
==============================================================================
--- python/trunk/Lib/test/test_file.py	(original)
+++ python/trunk/Lib/test/test_file.py	Tue Dec 23 04:30:15 2008
@@ -120,6 +120,8 @@
         except:
             self.assertEquals(self.f.__exit__(*sys.exc_info()), None)
 
+    def testReadWhenWriting(self):
+        self.assertRaises(IOError, self.f.read)
 
 class OtherFileTests(unittest.TestCase):
 

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Tue Dec 23 04:30:15 2008
@@ -12,6 +12,9 @@
 Core and Builtins
 -----------------
 
+- Added test case to ensure attempts to read from a file opened for writing
+  fail.
+
 - Issue #2467: gc.DEBUG_STATS reported invalid elapsed times. Also, always
   print elapsed times, not only when some objects are uncollectable /
   unreachable. Original patch by Neil Schemenauer.


More information about the Python-checkins mailing list