[Zope3-checkins] SVN: Zope3/branches/3.3/ Added work around for logging package exit problems.

Jim Fulton jim at zope.com
Fri Aug 18 12:07:32 EDT 2006


Log message for revision 69656:
  Added work around for logging package exit problems.
  

Changed:
  U   Zope3/branches/3.3/releases/Zope/test.py
  U   Zope3/branches/3.3/releases/Zope/zopetest
  U   Zope3/branches/3.3/test.py

-=-
Modified: Zope3/branches/3.3/releases/Zope/test.py
===================================================================
--- Zope3/branches/3.3/releases/Zope/test.py	2006-08-18 16:07:28 UTC (rev 69655)
+++ Zope3/branches/3.3/releases/Zope/test.py	2006-08-18 16:07:31 UTC (rev 69656)
@@ -42,8 +42,16 @@
                '--unit', '--verbose']
 result = testrunner.run(defaultargs)
 
+# Note, the logging system has bugs, fixed in Python 2.5 that cause spurious
+# errors on exit.  We'll execute a fairly voilent suicide to try to avoid
+# these.  Given that this is just a test runner, this should be OK.
+
 # Avoid spurious error during exit. Some thing is trying to log
 # something after the files used by the logger have been closed.
 logging.disable(999999999)
 
-sys.exit(result)
+# Because we're about to use os._exit, we flush output so we don't miss any.
+sys.stdout.flush()
+sys.stderr.flush()
+
+os._exit(result)

Modified: Zope3/branches/3.3/releases/Zope/zopetest
===================================================================
--- Zope3/branches/3.3/releases/Zope/zopetest	2006-08-18 16:07:28 UTC (rev 69655)
+++ Zope3/branches/3.3/releases/Zope/zopetest	2006-08-18 16:07:31 UTC (rev 69656)
@@ -36,4 +36,19 @@
 warnings.filterwarnings(
     'ignore', 'PyCrypto', RuntimeWarning, 'twisted[.]conch[.]ssh')
 
-sys.exit(testrunner.run(defaults))
+result = testrunner.run(defaults)
+
+# Note, the logging system has bugs, fixed in Python 2.5 that cause spurious
+# errors on exit.  We'll execute a fairly voilent suicide to try to avoid
+# these.  Given that this is just a test runner, this should be OK.
+
+# Avoid spurious error during exit. Some thing is trying to log
+# something after the files used by the logger have been closed.
+import logging
+logging.disable(999999999)
+
+# Because we're about to use os._exit, we flush output so we don't miss any.
+sys.stdout.flush()
+sys.stderr.flush()
+
+os._exit(result)

Modified: Zope3/branches/3.3/test.py
===================================================================
--- Zope3/branches/3.3/test.py	2006-08-18 16:07:28 UTC (rev 69655)
+++ Zope3/branches/3.3/test.py	2006-08-18 16:07:31 UTC (rev 69656)
@@ -60,8 +60,16 @@
 
 result = testrunner.run(defaults)
 
+# Note, the logging system has bugs, fixed in Python 2.5 that cause spurious
+# errors on exit.  We'll execute a fairly voilent suicide to try to avoid
+# these.  Given that this is just a test runner, this should be OK.
+
 # Avoid spurious error during exit. Some thing is trying to log
 # something after the files used by the logger have been closed.
 logging.disable(999999999)
 
-sys.exit(result)
+# Because we're about to use os._exit, we flush output so we don't miss any.
+sys.stdout.flush()
+sys.stderr.flush()
+
+os._exit(result)



More information about the Zope3-Checkins mailing list