Commit 0a330598 authored by Fred Drake's avatar Fred Drake

clean some of the cruft out of this test code; it's no longer useful

(the tests themselves still aren't being run; we need decent
save/restore behavior from the logging package to do this properly)
parent 16802dc1
...@@ -29,26 +29,10 @@ severity_string = { ...@@ -29,26 +29,10 @@ severity_string = {
300: 'PANIC', 300: 'PANIC',
} }
class StupidLogTest(unittest.TestCase): class EventLogTest(unittest.TestCase):
"""Test zLOG with the default implementation. """Test zLOG with the default implementation."""
The default implementation uses the environment variables
STUPID_LOG_FILE and STUPID_LOG_SEVERITY.
"""
prefix = 'STUPID'
def wipeEnvironment(self):
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 setUp(self): def setUp(self):
self.wipeEnvironment()
self.path = tempfile.mktemp() self.path = tempfile.mktemp()
self._severity = 0 self._severity = 0
# Windows cannot remove a file that's open. The logging code # Windows cannot remove a file that's open. The logging code
...@@ -67,7 +51,6 @@ class StupidLogTest(unittest.TestCase): ...@@ -67,7 +51,6 @@ class StupidLogTest(unittest.TestCase):
h.close() h.close()
del logging._handlers[h] del logging._handlers[h]
os.remove(self.path) os.remove(self.path)
self.wipeEnvironment()
zLOG.initialize() zLOG.initialize()
def setLog(self, severity=0): def setLog(self, severity=0):
...@@ -157,15 +140,9 @@ class StupidLogTest(unittest.TestCase): ...@@ -157,15 +140,9 @@ class StupidLogTest(unittest.TestCase):
f.close() f.close()
class EventLogTest(StupidLogTest):
""" Test alternate envvars EVENT_LOG_FILE and EVENT_LOG_SEVERITY """
prefix = 'EVENT'
def test_suite(): def test_suite():
return unittest.TestSuite() return unittest.TestSuite()
suite = unittest.makeSuite(StupidLogTest, 'check') return unittest.makeSuite(EventLogTest, 'check')
suite.addTest(unittest.makeSuite(EventLogTest, 'check'))
return suite
if __name__ == "__main__": if __name__ == "__main__":
loader = unittest.TestLoader() loader = unittest.TestLoader()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment