[Zodb-checkins] CVS: StandaloneZODB/zLOG/tests - testzLog.py:1.4

Jeremy Hylton jeremy@zope.com
Wed, 10 Oct 2001 10:05:16 -0400


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

Modified Files:
	testzLog.py 
Log Message:
In verifyEntry(), check for end-of-file before anything is found.

Add getLogFile() method that provides hook for SpreadLog subclass.


=== StandaloneZODB/zLOG/tests/testzLog.py 1.3 => 1.4 ===
         line = f.readline()
         while line != "------\n":
+            if not line:
+                self.fail("can't find entry in log file")
             line = f.readline()
             
         line = f.readline().strip()
@@ -80,18 +82,21 @@
                 if line == last:
                     break
 
+    def getLogFile(self):
+        return open(self.path, 'rb')
+
     def checkBasics(self):
         self.setLog()
         zLOG.LOG("basic", zLOG.INFO, "summary")
 
-        f = open(self.path, 'rb')
+        f = self.getLogFile()
         self.verifyEntry(f, subsys="basic", summary="summary")
 
     def checkDetail(self):
         self.setLog()
         zLOG.LOG("basic", zLOG.INFO, "xxx", "this is a detail")
 
-        f = open(self.path, 'rb')
+        f = self.getLogFile()
         self.verifyEntry(f, subsys="basic", detail="detail")
 
     def checkError(self):
@@ -104,7 +109,7 @@
         zLOG.LOG("basic", zLOG.INFO, "summary")
         zLOG.LOG("basic", zLOG.ERROR, "raised exception", error=err)
 
-        f = open(self.path, 'rb')
+        f = self.getLogFile()
         self.verifyEntry(f, subsys="basic", summary="summary")
         self.verifyEntry(f, subsys="basic", severity=zLOG.ERROR,
                          error=err)