[Python-checkins] r58351 - python/trunk/Lib/test/test_bufio.py
neal.norwitz
python-checkins at python.org
Sat Oct 6 21:16:29 CEST 2007
Author: neal.norwitz
Date: Sat Oct 6 21:16:28 2007
New Revision: 58351
Modified:
python/trunk/Lib/test/test_bufio.py
Log:
Ensure that this test will pass even if another test left an unwritable TESTFN.
Also use the safe unlink in test_support instead of rolling our own here.
Modified: python/trunk/Lib/test/test_bufio.py
==============================================================================
--- python/trunk/Lib/test/test_bufio.py (original)
+++ python/trunk/Lib/test/test_bufio.py Sat Oct 6 21:16:28 2007
@@ -13,6 +13,9 @@
# Write s + "\n" + s to file, then open it and ensure that successive
# .readline()s deliver what we wrote.
+ # Ensure we can open TESTFN for writing.
+ test_support.unlink(test_support.TESTFN)
+
# Since C doesn't guarantee we can write/read arbitrary bytes in text
# files, use binary mode.
f = open(test_support.TESTFN, "wb")
@@ -31,11 +34,7 @@
self.assert_(not line) # Must be at EOF
f.close()
finally:
- try:
- import os
- os.unlink(test_support.TESTFN)
- except:
- pass
+ test_support.unlink(test_support.TESTFN)
def drive_one(self, pattern):
for length in lengths:
More information about the Python-checkins
mailing list