[Zope3-checkins] SVN: zope.testing/trunk/src/zope/testing/testrunner.py The profile tests failed on Windows when using Python >= 2.4.2,

Tim Peters tim.one at comcast.net
Mon Oct 3 16:50:31 EDT 2005


Log message for revision 38728:
  The profile tests failed on Windows when using Python >= 2.4.2,
  due to trying to unlink an open file.  Repaired that.
  
  The profile tests still fail on Windows when using Python < 2.4.2
  _and_ running Python with -O, but for an apparently entirely
  different reason.  Haven't figured that one out yet.
  
  This is interfering with creating a usable zope.testing tag for
  ZODB 3.4.2.
  

Changed:
  U   zope.testing/trunk/src/zope/testing/testrunner.py

-=-
Modified: zope.testing/trunk/src/zope/testing/testrunner.py
===================================================================
--- zope.testing/trunk/src/zope/testing/testrunner.py	2005-10-03 20:19:50 UTC (rev 38727)
+++ zope.testing/trunk/src/zope/testing/testrunner.py	2005-10-03 20:50:30 UTC (rev 38728)
@@ -186,7 +186,7 @@
                 os.unlink(file_name)
 
         # set up the output file
-        dummy, file_path = tempfile.mkstemp(prof_suffix, prof_prefix, '.')
+        oshandle, file_path = tempfile.mkstemp(prof_suffix, prof_prefix, '.')
         prof = hotshot.Profile(file_path)
         prof.start()
 
@@ -201,6 +201,10 @@
         if hotshot is not None and options.profile:
             prof.stop()
             prof.close()
+            # We must explicitly close the handle mkstemp returned, else
+            # on Windows this dies the next around just above due to an
+            # attempt to unlink a still-open file.
+            os.close(oshandle)
 
     if hotshot is not None and options.profile and not options.resume_layer:
         stats = None



More information about the Zope3-Checkins mailing list