[Zodb-checkins] CVS: ZODB3/zLOG/tests - testzLogConfig.py:1.2

Fred L. Drake, Jr. fred@zope.com
Mon, 13 Jan 2003 11:16:46 -0500


Update of /cvs-repository/ZODB3/zLOG/tests
In directory cvs.zope.org:/tmp/cvs-serv27585/zLOG/tests

Modified Files:
	testzLogConfig.py 
Log Message:
Make sure the datatype for the "logger" section type adds a NullHandler if
no other handlers are provided.  This is needed to avoid warnings on stderr
from the logging package.


=== ZODB3/zLOG/tests/testzLogConfig.py 1.1 => 1.2 ===
--- ZODB3/zLOG/tests/testzLogConfig.py:1.1	Fri Jan 10 13:33:10 2003
+++ ZODB3/zLOG/tests/testzLogConfig.py	Mon Jan 13 11:16:43 2003
@@ -19,6 +19,7 @@
 import unittest
 
 import ZConfig
+import zLOG.LogHandlers
 import zLOG.tests
 
 
@@ -54,7 +55,11 @@
         self.assertEqual(conf.logger.level, logging.INFO)
         logger = conf.logger()
         self.assert_(isinstance(logger, logging.Logger))
-        self.assertEqual(logger.handlers, [])
+        # Make sure there's a NullHandler, since a warning gets
+        # printed if there are no handlers:
+        self.assertEqual(len(logger.handlers), 1)
+        self.assert_(isinstance(logger.handlers[0],
+                                zLOG.LogHandlers.NullHandler))
 
     # XXX need to make sure each loghandler datatype gets exercised.