diff options
author | Guido van Rossum <guido@python.org> | 2007-10-25 23:21:03 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-10-25 23:21:03 (GMT) |
commit | 79b79eeab239f97d2a1374a83799aebc11e9ae7e (patch) | |
tree | 6e2aab237c4210ee875aac288b42e16f18df9939 /Lib/test | |
parent | 687b9c0779d81714d8ad22157e8e0f5dfc88d904 (diff) | |
download | cpython-79b79eeab239f97d2a1374a83799aebc11e9ae7e.zip cpython-79b79eeab239f97d2a1374a83799aebc11e9ae7e.tar.gz cpython-79b79eeab239f97d2a1374a83799aebc11e9ae7e.tar.bz2 |
Patch # 1323 by Amaury Forgeot d'Arc.
This patch corrects a problem in test_file.py on Windows:
f.truncate() seeks to the truncation point, but does not empty the
buffers. In the test, f.tell() returns -1...
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_file.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Lib/test/test_file.py b/Lib/test/test_file.py index f2718b2..ab29932 100644 --- a/Lib/test/test_file.py +++ b/Lib/test/test_file.py @@ -181,12 +181,13 @@ class OtherFileTests(unittest.TestCase): self.assertEquals(d, s) def testTruncateOnWindows(self): + # SF bug <http://www.python.org/sf/801631> + # "file.truncate fault on windows" + os.unlink(TESTFN) + f = open(TESTFN, 'wb') - def bug801631(): - # SF bug <http://www.python.org/sf/801631> - # "file.truncate fault on windows" - f = open(TESTFN, 'wb') + try: f.write(b'12345678901') # 11 bytes f.close() @@ -205,10 +206,8 @@ class OtherFileTests(unittest.TestCase): size = os.path.getsize(TESTFN) if size != 5: self.fail("File size after ftruncate wrong %d" % size) - - try: - bug801631() finally: + f.close() os.unlink(TESTFN) def testIteration(self): |