[Zodb-checkins] CVS: ZODB4/src/zdaemon/tests - testDaemon.py:1.7.2.2

Jeremy Hylton jeremy at zope.com
Thu Jun 19 14:53:10 EDT 2003


Update of /cvs-repository/ZODB4/src/zdaemon/tests
In directory cvs.zope.org:/tmp/cvs-serv15482

Modified Files:
      Tag: ZODB3-2-merge
	testDaemon.py 
Log Message:
Make sure the test handler is only used during the test.


=== ZODB4/src/zdaemon/tests/testDaemon.py 1.7.2.1 => 1.7.2.2 ===
--- ZODB4/src/zdaemon/tests/testDaemon.py:1.7.2.1	Thu Jun 19 13:21:38 2003
+++ ZODB4/src/zdaemon/tests/testDaemon.py	Thu Jun 19 13:53:09 2003
@@ -32,21 +32,23 @@
         if record.levelno >= logging.ERROR:
             raise TestDoneError(self.format(record))
 
-logging.root.addHandler(TestErrorHandler())
-logging.root.setLevel(logging.ERROR)
-
 class DaemonTest(unittest.TestCase):
 
     dir, file = os.path.split(zdaemon.tests.__file__)
     script = os.path.join(dir, "testDaemon.py")
 
     def setUp(self):
+        self.handler = TestErrorHandler()
+        logging.root.addHandler(self.handler)
+        self.level = logging.root.level # is there a better way?
+        logging.root.setLevel(logging.ERROR)
         os.environ["Z_DEBUG_MODE"] = ""
         if os.environ.has_key("ZDAEMON_MANAGED"):
             del os.environ["ZDAEMON_MANAGED"]
 
     def tearDown(self):
-        pass
+        logging.root.removeHandler(self.handler)
+        logging.root.setLevel(self.level)
 
     def run(self, arg):
         try:




More information about the Zodb-checkins mailing list