[Zodb-checkins] CVS: Zope/lib/python/zLOG/tests - testzLog.py:1.7
Chris McDonough
chrism@zope.com
Wed, 3 Jul 2002 22:31:54 -0400
Update of /cvs-repository/Zope/lib/python/zLOG/tests
In directory cvs.zope.org:/tmp/cvs-serv17236/lib/python/zLOG/tests
Modified Files:
testzLog.py
Log Message:
- The default "start" script now causes the event log to be sent to
standard output unless the "EVENT_LOG_FILE" or "STUPID_LOG_FILE"
environment variable is set.
- The much-hated name "STUPID_LOG_FILE" now has a preferred
alias: "EVENT_LOG_FILE".
=== Zope/lib/python/zLOG/tests/testzLog.py 1.6 => 1.7 ===
The default implementation uses the environment variables
- STUPID_LOG_FILE and STUPID_LOG_SEVERITY. I am not making this
- up.
+ STUPID_LOG_FILE and STUPID_LOG_SEVERITY.
"""
-
+ prefix = 'STUPID'
def setUp(self):
self.path = tempfile.mktemp()
self._severity = 0
@@ -47,13 +46,17 @@
pass
if os.environ.has_key('STUPID_LOG_FILE'):
del os.environ['STUPID_LOG_FILE']
+ if os.environ.has_key('EVENT_LOG_FILE'):
+ del os.environ['EVENT_LOG_FILE']
if os.environ.has_key('STUPID_LOG_SEVERITY'):
del os.environ['STUPID_LOG_SEVERITY']
+ if os.environ.has_key('EVENT_LOG_SEVERITY'):
+ del os.environ['EVENT_LOG_SEVERITY']
def setLog(self, severity=0):
- os.environ['STUPID_LOG_FILE'] = self.path
+ os.environ['%s_LOG_FILE' % self.prefix] = self.path
if severity:
- os.environ['STUPID_LOG_SEVERITY'] = str(severity)
+ os.environ['%s_LOG_SEVERITY' % self.prefix] = str(severity)
self._severity = severity
zLOG.MinimalLogger._log.initialize()
@@ -128,8 +131,14 @@
self.verifyEntry(f, subsys="basic", severity=zLOG.ERROR,
error=err)
+class EventLogTest(StupidLogTest):
+ """ Test alternate envvars EVENT_LOG_FILE and EVENT_LOG_SEVERITY """
+ prefix = 'EVENT'
+
def test_suite():
- return unittest.makeSuite(StupidLogTest, 'check')
+ suite = unittest.makeSuite(StupidLogTest, 'check')
+ suite.addTest(unittest.makeSuite(EventLogTest, 'check'))
+ return suite
if __name__ == "__main__":
loader = unittest.TestLoader()