]> granicus.if.org Git - python/commitdiff
testUnicodeOpen(): I have no idea why, but making this
authorTim Peters <tim.peters@gmail.com>
Fri, 9 Jun 2006 04:02:06 +0000 (04:02 +0000)
committerTim Peters <tim.peters@gmail.com>
Fri, 9 Jun 2006 04:02:06 +0000 (04:02 +0000)
test clean up after itself appears to fix the test failures
when test_optparse follows test_file.

test_main():  Get rid of TESTFN no matter what.  That's
also enough to fix the mystery failures.  Doesn't hurt
to fix them twice :-)

Lib/test/test_file.py

index e19526a8791b73c8a07cfee00c14c54dd798c502..fe3bb922a986f0d425c1914a26926642ee5ad8ed 100644 (file)
@@ -135,6 +135,7 @@ class OtherFileTests(unittest.TestCase):
         f = open(unicode(TESTFN), "w")
         self.assert_(repr(f).startswith("<open file u'" + TESTFN))
         f.close()
+        os.unlink(TESTFN)
 
     def testBadModeArgument(self):
         # verify that we get a sensible error message for bad mode argument
@@ -313,7 +314,13 @@ class OtherFileTests(unittest.TestCase):
 
 
 def test_main():
-    run_unittest(AutoFileTests, OtherFileTests)
+    # Historically, these tests have sloppy about removing TESTFN.  So get
+    # rid of it no matter what.
+    try:
+        run_unittest(AutoFileTests, OtherFileTests)
+    finally:
+        if os.path.exists(TESTFN):
+            os.unlink(TESTFN)
 
 if __name__ == '__main__':
     test_main()