summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2008-03-25 06:35:10 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2008-03-25 06:35:10 (GMT)
commitbe9160b035449b00ff4aee1837c510ec518b08bc (patch)
treedf7274f9816110fec0c9840e28d5706ce89435b2 /Lib
parent88440960f9f430581ba5766aee1f0712ac96cb54 (diff)
downloadcpython-be9160b035449b00ff4aee1837c510ec518b08bc.zip
cpython-be9160b035449b00ff4aee1837c510ec518b08bc.tar.gz
cpython-be9160b035449b00ff4aee1837c510ec518b08bc.tar.bz2
Don't try to close a non-open file.
Don't let file removal cause the test to fail.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_set.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_set.py b/Lib/test/test_set.py
index 3d09d87..6b3df3d 100644
--- a/Lib/test/test_set.py
+++ b/Lib/test/test_set.py
@@ -283,15 +283,15 @@ class TestJointOps(unittest.TestCase):
w = ReprWrapper()
s = self.thetype([w])
w.value = s
+ fo = open(test_support.TESTFN, "wb")
try:
- fo = open(test_support.TESTFN, "wb")
print >> fo, s,
fo.close()
fo = open(test_support.TESTFN, "rb")
self.assertEqual(fo.read(), repr(s))
finally:
fo.close()
- os.remove(test_support.TESTFN)
+ test_support.unlink(test_support.TESTFN)
def test_do_not_rehash_dict_keys(self):
n = 10
@@ -626,15 +626,15 @@ class TestBasicOps(unittest.TestCase):
self.assertEqual(repr(self.set), self.repr)
def test_print(self):
+ fo = open(test_support.TESTFN, "wb")
try:
- fo = open(test_support.TESTFN, "wb")
print >> fo, self.set,
fo.close()
fo = open(test_support.TESTFN, "rb")
self.assertEqual(fo.read(), repr(self.set))
finally:
fo.close()
- os.remove(test_support.TESTFN)
+ test_support.unlink(test_support.TESTFN)
def test_length(self):
self.assertEqual(len(self.set), self.length)