[Zodb-checkins] CVS: Zope/lib/python/zLOG/tests - testzLog.py:1.11
Fred L. Drake, Jr.
fred@zope.com
Fri, 22 Nov 2002 13:17:40 -0500
Update of /cvs-repository/Zope/lib/python/zLOG/tests
In directory cvs.zope.org:/tmp/cvs-serv30903/tests
Modified Files:
testzLog.py
Log Message:
Revert zLOG changes that proved to be contentious.
=== Zope/lib/python/zLOG/tests/testzLog.py 1.10 => 1.11 ===
--- Zope/lib/python/zLOG/tests/testzLog.py:1.10 Thu Nov 21 18:17:57 2002
+++ Zope/lib/python/zLOG/tests/testzLog.py Fri Nov 22 13:17:39 2002
@@ -16,10 +16,6 @@
import sys
import tempfile
import unittest
-
-from cStringIO import StringIO
-
-import ZConfig
import zLOG
severity_string = {
@@ -64,7 +60,7 @@
def setLog(self, severity=0):
os.environ['%s_LOG_FILE' % self.prefix] = self.path
- if severity is not None:
+ if severity:
os.environ['%s_LOG_SEVERITY' % self.prefix] = str(severity)
self._severity = severity
zLOG.MinimalLogger._log.initialize()
@@ -111,19 +107,13 @@
def getLogFile(self):
return open(self.path, 'rb')
- def checkBasics(self, severity=None):
- self.setLog(severity=severity)
+ def checkBasics(self):
+ self.setLog()
zLOG.LOG("basic", zLOG.INFO, "summary")
f = self.getLogFile()
self.verifyEntry(f, subsys="basic", summary="summary")
- def checkBasicsNumericSeverity(self):
- self.checkBasics(severity=0)
-
- def checkBasicsNamedSeverity(self):
- self.checkBasics(severity='info')
-
def checkDetail(self):
self.setLog()
zLOG.LOG("basic", zLOG.INFO, "xxx", "this is a detail")
@@ -150,24 +140,9 @@
""" Test alternate envvars EVENT_LOG_FILE and EVENT_LOG_SEVERITY """
prefix = 'EVENT'
-class ConfigLogTest(StupidLogTest):
- """ Test using a ZConfig section to control logging. """
-
- def setLog(self, severity=None):
- self._severity = severity
- text = "<Log>\n path %s \n" % self.path
- if severity is not None:
- text += " level %s \n" % severity
- text += "</Log>"
- sio = StringIO(text)
- conf = ZConfig.loadfile(sio)
- zLOG.MinimalLogger._log.initialize_with_config(conf)
-
-
def test_suite():
suite = unittest.makeSuite(StupidLogTest, 'check')
suite.addTest(unittest.makeSuite(EventLogTest, 'check'))
- suite.addTest(unittest.makeSuite(ConfigLogTest, 'check'))
return suite
if __name__ == "__main__":