[Zodb-checkins] CVS: Packages3/zdaemon/tests - testDaemon.py:1.7

Jeremy Hylton jeremy at zope.com
Thu Jun 19 13:44:37 EDT 2003


Update of /cvs-repository/Packages3/zdaemon/tests
In directory cvs.zope.org:/tmp/cvs-serv4181

Modified Files:
	testDaemon.py 
Log Message:
Replace zLOG hack with slightly cleaner logging hack.


=== Packages3/zdaemon/tests/testDaemon.py 1.6 => 1.7 ===
--- Packages3/zdaemon/tests/testDaemon.py:1.6	Thu Jun 19 11:48:54 2003
+++ Packages3/zdaemon/tests/testDaemon.py	Thu Jun 19 12:44:36 2003
@@ -7,7 +7,6 @@
 import sys
 
 if __name__ == "__main__":
-
     arg = sys.argv[1]
     if arg == "signal":
         import signal
@@ -18,6 +17,7 @@
 
 # The rest is unittest stuff that can be run by testrunner.py.
 
+import logging
 import unittest
 import zdaemon
 import zdaemon.tests
@@ -25,6 +25,14 @@
 
 class TestDoneError(RuntimeError):
     pass
+
+class TestErrorHandler(logging.Handler):
+
+    def emit(self, record):
+        if record.levelno >= logging.ERROR:
+            raise TestDoneError(self.format(record))
+
+logging.root.addHandler(TestErrorHandler())
 
 class DaemonTest(unittest.TestCase):
 




More information about the Zodb-checkins mailing list