]> granicus.if.org Git - python/commitdiff
Always try to delete the data file before and after the test.
authorNeal Norwitz <nnorwitz@gmail.com>
Mon, 24 Mar 2008 06:18:09 +0000 (06:18 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Mon, 24 Mar 2008 06:18:09 +0000 (06:18 +0000)
This will hopefully avoid spurious failures if the file doesn't
have the proper permissions to write for some reason.

Lib/test/test_gzip.py
Lib/test/test_io.py

index 08f7f3feefd8d5d69c8e0ab1fb47a82ff6e8887c..0010112a8b28b64688099cc8d79ea551a56c9b57 100644 (file)
@@ -25,13 +25,10 @@ class TestGzip(unittest.TestCase):
     filename = test_support.TESTFN
 
     def setUp (self):
-        pass
+        test_support.unlink(self.filename)
 
     def tearDown (self):
-        try:
-            os.unlink(self.filename)
-        except os.error:
-            pass
+        test_support.unlink(self.filename)
 
 
     def test_write (self):
index 513e1f3b82f35e8216c82a06fa31b5326b93ecf4..f0e793120580d6c54b34ca1bdb6b57e32d24d410 100644 (file)
@@ -79,6 +79,9 @@ class MockNonBlockWriterIO(io.RawIOBase):
 
 class IOTest(unittest.TestCase):
 
+    def setUp(self):
+        test_support.unlink(test_support.TESTFN)
+
     def tearDown(self):
         test_support.unlink(test_support.TESTFN)
 
@@ -619,6 +622,7 @@ class TextIOWrapperTest(unittest.TestCase):
     def setUp(self):
         self.testdata = b"AAA\r\nBBB\rCCC\r\nDDD\nEEE\r\n"
         self.normalized = b"AAA\nBBB\nCCC\nDDD\nEEE\n".decode("ascii")
+        test_support.unlink(test_support.TESTFN)
 
     def tearDown(self):
         test_support.unlink(test_support.TESTFN)