Commit 4e3ab3b2 authored by Barry Warsaw's avatar Barry Warsaw

Environmental pollution was causing testzLog to fail in checkBasics

depending on whether the full or a partial test suite was run.  In
particular, in my case there was a EVENT_LOG_FILE turd left in the
environment which was causes StupidLogTest's checkBasics to fail.

The fix is to wipe the environment in both the setup and the tear
down, although I wonder why EventLogTest's teardown didn't clean
things up properly.  Hmm, with this patch the test suite succeeds.
parent 79938907
......@@ -35,15 +35,8 @@ class StupidLogTest(unittest.TestCase):
STUPID_LOG_FILE and STUPID_LOG_SEVERITY.
"""
prefix = 'STUPID'
def setUp(self):
self.path = tempfile.mktemp()
self._severity = 0
def tearDown(self):
try:
os.remove(self.path)
except os.error:
pass
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'):
......@@ -53,6 +46,18 @@ class StupidLogTest(unittest.TestCase):
if os.environ.has_key('EVENT_LOG_SEVERITY'):
del os.environ['EVENT_LOG_SEVERITY']
def setUp(self):
self.wipeEnvironment()
self.path = tempfile.mktemp()
self._severity = 0
def tearDown(self):
try:
os.remove(self.path)
except os.error:
pass
self.wipeEnvironment()
def setLog(self, severity=0):
os.environ['%s_LOG_FILE' % self.prefix] = self.path
if severity:
......
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