[Zodb-checkins] CVS: Packages/ZEO - testZEO.py:1.1.2.5

jeremy@digicool.com jeremy@digicool.com
Fri, 20 Apr 2001 15:18:52 -0400 (EDT)


Update of /cvs-repository/Packages/ZEO/tests
In directory korak:/tmp/cvs-serv24694

Modified Files:
      Tag: ZEO-ZRPC-Dev
	testZEO.py 
Log Message:
Replace zLOG with zeolog.
Refactor GenericTests so that tearDown() calls delStorage(), which can
clean up a file storage.




--- Updated File testZEO.py in package Packages/ZEO --
--- testZEO.py	2001/04/19 18:26:05	1.1.2.4
+++ testZEO.py	2001/04/20 19:18:52	1.1.2.5
@@ -12,7 +12,7 @@
 from ZEO.zrpc2 import ManagedServerConnection
 import ThreadedAsync, ZEO.trigger
 
-import zLOG
+from ZEO import zeolog
 
 # XXX The ZODB.tests package contains a grab bad things, including,
 # apparently, a collection of modules that define mixin classes
@@ -24,7 +24,7 @@
     def newConnection(self, sock, addr, nil):
         c = ManagedServerConnection(sock, addr, None, self)
         c.register_object(TestStorageProxy(self, c))
-        zLOG.LOG("TSS", zLOG.INFO, "connected: %s" % c)
+        zeolog.LOG("TSS", zeolog.INFO, "connected: %s" % c)
 
 class TestStorageProxy(ZEO.StorageServer.StorageProxy):
     def shutdown(self):
@@ -79,7 +79,6 @@
     def _get_serial(self, r):
         """Return oid -> serialno dict from sequence of ZEO replies."""
         d = {}
-        zLOG.LOG('ZTB', zLOG.BLATHER, 'reply: %s' % repr(r))
         if r is None:
             return None
         if type(r) == types.StringType:
@@ -123,12 +122,12 @@
 
     def tearDown(self):
         """Try to cause the tests to halt"""
-        zLOG.LOG("test", zLOG.INFO, "tearDown()")
         self.running = 0
         self._storage._server.rpc.callAsync('shutdown')
         self._storage._rpc_mgr.close()
         os.waitpid(self.__pid, 0)
         os.unlink(self.__sock)
+        self.delStorage()
         self.__super_tearDown()
 
     def startServer(self):
@@ -139,7 +138,7 @@
             self.__server = TestStorageServer(self.__sock, d)
             asyncore.loop()
         else:
-            zLOG.LOG("test", zLOG.INFO, "forked %s" % self.__pid)
+            zeolog.LOG("test", zeolog.INFO, "forked %s" % self.__pid)
             
     def checkFirst(self):
         self._storage.tpc_begin(self._transaction)
@@ -147,7 +146,6 @@
 
 class ZEOFileStorageTests(GenericTests):
     __super_setUp = GenericTests.setUp
-    __super_tearDown = GenericTests.tearDown
     
     from ZODB.FileStorage import FileStorage
 
@@ -155,15 +153,14 @@
         self.__fs_base = tempfile.mktemp()
         self.__super_setUp()
 
-    def tearDown(self):
-        self.__super_tearDown()
+    def getStorage(self):
+        return self.FileStorage(self.__fs_base, create=1)
+
+    def delStorage(self):
         # file storage appears to create three files
         for ext in '', '.index', '.lock', '.tmp':
             path = self.__fs_base + ext
             os.unlink(path)
-    
-    def getStorage(self):
-        return self.FileStorage(self.__fs_base, create=1)
         
 def main():
     tests = unittest.makeSuite(ZEOFileStorageTests, 'check')