From: Neal Norwitz Date: Mon, 24 Mar 2008 06:18:09 +0000 (+0000) Subject: Always try to delete the data file before and after the test. X-Git-Tag: v3.0a4~72 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e7789b186d640ee00e5709fcfbeca43780d379e4;p=thirdparty%2FPython%2Fcpython.git Always try to delete the data file before and after the test. This will hopefully avoid spurious failures if the file doesn't have the proper permissions to write for some reason. --- diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py index 08f7f3feefd8..0010112a8b28 100644 --- a/Lib/test/test_gzip.py +++ b/Lib/test/test_gzip.py @@ -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): diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index 513e1f3b82f3..f0e793120580 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -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)