summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_bufio.py
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2007-10-06 19:16:28 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2007-10-06 19:16:28 (GMT)
commit92abad24d68823dc3c334d05b7bc5375db049b7b (patch)
tree5fcb8ea7c4c895a9751979742e505f4382cb9434 /Lib/test/test_bufio.py
parent71e4fb587787fc4d0975e69465f28a31628d7379 (diff)
downloadcpython-92abad24d68823dc3c334d05b7bc5375db049b7b.zip
cpython-92abad24d68823dc3c334d05b7bc5375db049b7b.tar.gz
cpython-92abad24d68823dc3c334d05b7bc5375db049b7b.tar.bz2
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.
Diffstat (limited to 'Lib/test/test_bufio.py')
-rw-r--r--Lib/test/test_bufio.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/Lib/test/test_bufio.py b/Lib/test/test_bufio.py
index 14a926a..4f5de10 100644
--- a/Lib/test/test_bufio.py
+++ b/Lib/test/test_bufio.py
@@ -13,6 +13,9 @@ class BufferSizeTest(unittest.TestCase):
# 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 @@ class BufferSizeTest(unittest.TestCase):
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: