[Python-checkins] r46765 - python/trunk/Lib/test/test_file.py

tim.peters python-checkins at python.org
Fri Jun 9 06:02:06 CEST 2006


Author: tim.peters
Date: Fri Jun  9 06:02:06 2006
New Revision: 46765

Modified:
   python/trunk/Lib/test/test_file.py
Log:
testUnicodeOpen():  I have no idea why, but making this
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 :-)


Modified: python/trunk/Lib/test/test_file.py
==============================================================================
--- python/trunk/Lib/test/test_file.py	(original)
+++ python/trunk/Lib/test/test_file.py	Fri Jun  9 06:02:06 2006
@@ -135,6 +135,7 @@
         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 @@
 
 
 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()


More information about the Python-checkins mailing list