[Zodb-checkins] CVS: ZEO/ZEO/tests - testZEO.py:1.16.4.4.2.11

Jeremy Hylton jeremy@zope.com
Thu, 30 May 2002 17:52:54 -0400


Update of /cvs-repository/ZEO/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv8956/tests

Modified Files:
      Tag: ZEO2-branch
	testZEO.py 
Log Message:
Merge UnixConnectionTests back into ConnectionTests.

There is no longer a difference between the Unix code and the Windows
code.


=== ZEO/ZEO/tests/testZEO.py 1.16.4.4.2.10 => 1.16.4.4.2.11 ===
     del i
 
-    def openClientStorage(self, cache='', cache_size=200000, wait=1):
-        # defined by subclasses
-        pass
+    def setUp(self):
+        """Start a ZEO server using a Unix domain socket
+
+        The ZEO server uses the storage object returned by the
+        getStorage() method.
+        """
+        self.running = 1
+        self.file = tempfile.mktemp()
+        self.addr = []
+        self._pids = []
+        self._servers = []
+        self._newAddr()
+        self._startServer()
+
+    def _newAddr(self):
+        self.addr.append(self._getAddr())
 
-    def shutdownServer(self):
-        # defined by subclasses
-        pass
+    def _getAddr(self):
+        return '', self.ports.pop()
+
+    def _startServer(self, create=1, index=0):
+        path = "%s.%d" % (self.file, index)
+        addr = self.addr[index]
+        pid, server = forker.start_zeo_server('FileStorage',
+                                              (path, create), addr)
+        self._pids.append(pid)
+        self._servers.append(server)
+
+    def shutdownServer(self, index=0):
+        if self.running:
+            self.running = 0
+            self._servers[index].close()
+            try:
+                os.waitpid(self._pids[index], 0)
+            except os.error:
+                pass
+
+    def openClientStorage(self, cache='', cache_size=200000, wait=1):
+        base = ZEO.ClientStorage.ClientStorage(self.addr,
+                                               client=cache,
+                                               cache_size=cache_size,
+                                               wait=wait,
+                                               min_disconnect_poll=0.1)
+        storage = PackWaitWrapper(base)
+        storage.registerDB(DummyDB(), None)
+        return storage
 
     def tearDown(self):
         """Try to cause the tests to halt"""
@@ -332,96 +371,6 @@
             # inherit from POSException.
         zLOG.LOG("checkReconnection", zLOG.INFO, "finished")
 
-class UnixConnectionTests(ConnectionTests):
-
-    def setUp(self):
-        """Start a ZEO server using a Unix domain socket
-
-        The ZEO server uses the storage object returned by the
-        getStorage() method.
-        """
-        self.running = 1
-        self.file = tempfile.mktemp()
-        self.addr = []
-        self._pids = []
-        self._servers = []
-        self._newAddr()
-        self._startServer()
-
-    def _newAddr(self):
-        self.addr.append(self._getAddr())
-
-    def _getAddr(self):
-        return '', self.ports.pop()
-
-    def _startServer(self, create=1, index=0):
-        path = "%s.%d" % (self.file, index)
-        addr = self.addr[index]
-        pid, server = forker.start_zeo_server('FileStorage',
-                                              (path, create), addr)
-        self._pids.append(pid)
-        self._servers.append(server)
-
-    def openClientStorage(self, cache='', cache_size=200000, wait=1):
-        base = ZEO.ClientStorage.ClientStorage(self.addr,
-                                               client=cache,
-                                               cache_size=cache_size,
-                                               wait=wait,
-                                               min_disconnect_poll=0.1)
-        storage = PackWaitWrapper(base)
-        storage.registerDB(DummyDB(), None)
-        return storage
-
-    def shutdownServer(self, index=0):
-        if self.running:
-            self.running = 0
-            self._servers[index].close()
-            try:
-                os.waitpid(self._pids[index], 0)
-            except os.error:
-                pass
-
-class WindowsConnectionTests(ConnectionTests):
-
-    # XXX these tests are now out-of-date
-
-    def setUp(self):
-        self.file = tempfile.mktemp()
-        self._startServer()
-
-    def _startServer(self, create=1):
-        if create == 0:
-            port = self.addr[1]
-        else:
-            port = None
-        self.addr, self.test_a, pid = forker.start_zeo_server('FileStorage',
-                                                              (self.file,
-                                                               str(create)),
-                                                              port)
-        self.running = 1
-
-    def openClientStorage(self, cache='', cache_size=200000, wait=1):
-        base = ZEO.ClientStorage.ClientStorage(self.addr,
-                                               client=cache,
-                                               cache_size=cache_size,
-                                               # debug=1,
-                                               wait=1)
-        storage = PackWaitWrapper(base)
-        storage.registerDB(DummyDB(), None)
-        return storage
-
-    def shutdownServer(self):
-        if self.running:
-            self.running = 0
-            s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-            s.connect(self.test_a)
-            s.close()
-            time.sleep(1.0)
-
-    def tearDown(self):
-        self.shutdownServer()
-        self._storage.close()
-
 def get_methods(klass):
     l = [klass]
     meth = {}
@@ -435,10 +384,9 @@
     return meth.keys()
 
 if os.name == "posix":
-    test_classes = ZEOFileStorageTests, UnixConnectionTests
-##    test_classes = UnixConnectionTests,
+    test_classes = ZEOFileStorageTests, ConnectionTests
 elif os.name == "nt":
-    test_classes = WindowsZEOFileStorageTests, WindowsConnectionTests
+    test_classes = WindowsZEOFileStorageTests, ConnectionTests
 else:
     raise RuntimeError, "unsupported os: %s" % os.name