[Zope-Checkins]
SVN: Zope/branches/2.11/lib/python/Zope2/Startup/tests/testStarter.py
Suppress bogus handler errors.
Tres Seaver
tseaver at palladion.com
Fri Dec 28 17:38:07 EST 2007
Log message for revision 82507:
Suppress bogus handler errors.
Changed:
U Zope/branches/2.11/lib/python/Zope2/Startup/tests/testStarter.py
-=-
Modified: Zope/branches/2.11/lib/python/Zope2/Startup/tests/testStarter.py
===================================================================
--- Zope/branches/2.11/lib/python/Zope2/Startup/tests/testStarter.py 2007-12-28 17:52:45 UTC (rev 82506)
+++ Zope/branches/2.11/lib/python/Zope2/Startup/tests/testStarter.py 2007-12-28 22:38:06 UTC (rev 82507)
@@ -54,6 +54,7 @@
schema = None
def setUp(self):
+ from ZConfig.components.logger import loghandler
if self.schema is None:
ZopeStarterTestCase.schema = getSchema()
test_logger.LoggingTestBase.setUp(self)
@@ -66,12 +67,18 @@
pass
Products.__path__ = [d for d in Products.__path__
if os.path.exists(d)]
+
test_logger.LoggingTestBase.tearDown(self)
+
# reset logger states
for name in (None, 'access', 'trace'):
logger = logging.getLogger(name)
logger.__dict__.update(logger_states[name])
+ def _clearHandlers(self):
+ from ZConfig.components.logger import loghandler
+ del loghandler._reopenable_handlers[:]
+
def get_starter(self, conf):
starter = Zope2.Startup.get_starter()
starter.setConfiguration(conf)
@@ -144,6 +151,7 @@
self.assertEqual(logger.level, 15)
# We expect a debug handler and the startup handler:
self.assertEqual(len(logger.handlers), 2)
+
# XXX need to check that log messages get written to
# sys.stderr, not that the stream identity for the startup
# handler matches
@@ -312,6 +320,7 @@
os.unlink(os.path.join(TEMPNAME, name))
except:
pass
+ self._clearHandlers()
def testMakeLockFile(self):
# put something in the way (it should be deleted)
More information about the Zope-Checkins
mailing list