[Zope-Checkins] CVS: StandaloneZODB/zLOG/tests - testzLog.py:1.9

Barry Warsaw barry@wooz.org
Fri, 16 Aug 2002 16:31:33 -0400


Update of /cvs-repository/StandaloneZODB/zLOG/tests
In directory cvs.zope.org:/tmp/cvs-serv22532

Modified Files:
	testzLog.py 
Log Message:
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.


=== StandaloneZODB/zLOG/tests/testzLog.py 1.8 => 1.9 ===
--- StandaloneZODB/zLOG/tests/testzLog.py:1.8	Wed Aug 14 18:12:33 2002
+++ StandaloneZODB/zLOG/tests/testzLog.py	Fri Aug 16 16:31:33 2002
@@ -35,15 +35,8 @@
     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'):
@@ -52,6 +45,18 @@
             del os.environ['STUPID_LOG_SEVERITY']
         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