[Zodb-checkins] CVS: ZODB3/ZEO/tests - CommitLockTests.py:1.12 ConnectionTests.py:1.17 ThreadTests.py:1.6 testZEO.py:1.63

Jeremy Hylton jeremy@zope.com
Wed, 15 Jan 2003 13:19:50 -0500


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

Modified Files:
	CommitLockTests.py ConnectionTests.py ThreadTests.py 
	testZEO.py 
Log Message:
Rationalize disconnected exceptions so there is one root exception.

ZEO.Exceptions.ClientDisconnected will always be raised when a client
is disconnected.  There's also a subclass of this exception in
ZEO.zrpc.error so that it's possible to distinguish whether the error
occurred in the RPC layer or at the storage layer.


=== ZODB3/ZEO/tests/CommitLockTests.py 1.11 => 1.12 ===
--- ZODB3/ZEO/tests/CommitLockTests.py:1.11	Tue Jan  7 14:26:13 2003
+++ ZODB3/ZEO/tests/CommitLockTests.py	Wed Jan 15 13:19:16 2003
@@ -21,7 +21,7 @@
 from ZODB.tests.StorageTestBase import zodb_pickle, MinPO
 
 import ZEO.ClientStorage
-from ZEO.Exceptions import Disconnected
+from ZEO.Exceptions import ClientDisconnected
 from ZEO.tests.TestThread import TestThread
 
 ZERO = '\0'*8
@@ -56,7 +56,7 @@
                 self.storage.tpc_finish(self.trans)
             else:
                 self.storage.tpc_abort(self.trans)
-        except Disconnected:
+        except ClientDisconnected:
             pass
 
     def myvote(self):


=== ZODB3/ZEO/tests/ConnectionTests.py 1.16 => 1.17 ===
--- ZODB3/ZEO/tests/ConnectionTests.py:1.16	Wed Jan 15 11:53:42 2003
+++ ZODB3/ZEO/tests/ConnectionTests.py	Wed Jan 15 13:19:16 2003
@@ -27,7 +27,7 @@
 import zLOG
 
 from ZEO.ClientStorage import ClientStorage
-from ZEO.Exceptions import Disconnected
+from ZEO.Exceptions import ClientDisconnected
 from ZEO.zrpc.marshal import Marshaller
 from ZEO.tests import forker
 
@@ -200,7 +200,7 @@
             try:
                 self._dostore()
                 break
-            except Disconnected:
+            except ClientDisconnected:
                 self._storage.sync()
                 time.sleep(0.5)
 
@@ -264,7 +264,7 @@
         # Poll until the client disconnects
         self.pollDown()
         # Stores should fail now
-        self.assertRaises(Disconnected, self._dostore)
+        self.assertRaises(ClientDisconnected, self._dostore)
 
         # Restart the server
         self.startServer(create=0)
@@ -274,12 +274,13 @@
         self._dostore()
 
     def checkDisconnectionError(self):
-        # Make sure we get a Disconnected when we try to read an
+        # Make sure we get a ClientDisconnected when we try to read an
         # object when we're not connected to a storage server and the
         # object is not in the cache.
         self.shutdownServer()
         self._storage = self.openClientStorage('test', 1000, wait=0)
-        self.assertRaises(Disconnected, self._storage.load, 'fredwash', '')
+        self.assertRaises(ClientDisconnected,
+                          self._storage.load, 'fredwash', '')
 
     def checkBasicPersistence(self):
         # Verify cached data persists across client storage instances.
@@ -345,10 +346,8 @@
             try:
                 self._dostore(oid, data=obj)
                 break
-            except Disconnected:
+            except ClientDisconnected:
                 # Maybe the exception mess is better now
-##            except (Disconnected, select.error,
-##                    threading.ThreadError, socket.error):
                 zLOG.LOG("checkReconnection", zLOG.INFO,
                          "Error after server restart; retrying.",
                          error=sys.exc_info())
@@ -389,7 +388,7 @@
 
         try:
             self._dostore()
-        except Disconnected:
+        except ClientDisconnected:
             pass
         else:
             self._storage.close()
@@ -504,7 +503,7 @@
         # Poll until the client disconnects
         self.pollDown()
         # Stores should fail now
-        self.assertRaises(Disconnected, self._dostore)
+        self.assertRaises(ClientDisconnected, self._dostore)
 
         # Restart the server
         self.startServer(create=0, read_only=1)
@@ -533,7 +532,7 @@
         # Poll until the client disconnects
         self.pollDown()
         # Stores should fail now
-        self.assertRaises(Disconnected, self._dostore)
+        self.assertRaises(ClientDisconnected, self._dostore)
 
         # Restart the server, this time read-write
         self.startServer(create=0)
@@ -566,7 +565,7 @@
             try:
                 self._dostore()
                 break
-            except (Disconnected, ReadOnlyError):
+            except (ClientDisconnected, ReadOnlyError):
                 # If the client isn't connected at all, sync() returns
                 # quickly and the test fails because it doesn't wait
                 # long enough for the client.
@@ -691,7 +690,7 @@
         storage.tpc_begin(txn)
         storage.tpc_vote(txn)
         time.sleep(2)
-        self.assertRaises(Disconnected, storage.tpc_finish, txn)
+        self.assertRaises(ClientDisconnected, storage.tpc_finish, txn)
 
     def checkTimeoutOnAbort(self):
         storage = self.openClientStorage()


=== ZODB3/ZEO/tests/ThreadTests.py 1.5 => 1.6 ===
--- ZODB3/ZEO/tests/ThreadTests.py:1.5	Thu Oct  3 13:47:50 2002
+++ ZODB3/ZEO/tests/ThreadTests.py	Wed Jan 15 13:19:16 2003
@@ -19,7 +19,7 @@
 from ZODB.tests.StorageTestBase import zodb_pickle, MinPO
 
 import ZEO.ClientStorage
-from ZEO.Exceptions import Disconnected
+from ZEO.Exceptions import ClientDisconnected
 
 ZERO = '\0'*8
 
@@ -86,7 +86,7 @@
             self.gotValueError = 1
         try:
             self.storage.tpc_abort(self.trans)
-        except Disconnected:
+        except ClientDisconnected:
             self.gotDisconnected = 1
 
 


=== ZODB3/ZEO/tests/testZEO.py 1.62 => 1.63 ===
--- ZODB3/ZEO/tests/testZEO.py:1.62	Mon Jan 13 19:11:26 2003
+++ ZODB3/ZEO/tests/testZEO.py	Wed Jan 15 13:19:16 2003
@@ -39,7 +39,6 @@
 
 # ZEO imports
 from ZEO.ClientStorage import ClientStorage
-from ZEO.Exceptions import Disconnected
 
 # ZEO test support
 from ZEO.tests import forker, Cache