From: Skip Montanaro Date: Tue, 23 Dec 2008 03:30:15 +0000 (+0000) Subject: As a result of a regression that snuck into 2.5.3 add a test case that X-Git-Tag: v2.7a1~2506 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f205c13fac76ff31dd20849b1530d0a6baf4f1ad;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py index 2d791a55c07f..96f6da202355 100644 --- a/Lib/test/test_file.py +++ b/Lib/test/test_file.py @@ -120,6 +120,8 @@ class AutoFileTests(unittest.TestCase): except: self.assertEquals(self.f.__exit__(*sys.exc_info()), None) + def testReadWhenWriting(self): + self.assertRaises(IOError, self.f.read) class OtherFileTests(unittest.TestCase): diff --git a/Misc/NEWS b/Misc/NEWS index ebe61057cef8..775392437c06 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -12,6 +12,9 @@ What's New in Python 2.7 alpha 1 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.