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

Jeremy Hylton jeremy@zope.com
Thu, 19 Jun 2003 13:53:09 -0400


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: