Commit c765338c authored by Tim Peters's avatar Tim Peters

Try to close stuff.

parent fcd9a35e
...@@ -234,6 +234,7 @@ class ConnectionTests(CommonSetupTearDown): ...@@ -234,6 +234,7 @@ class ConnectionTests(CommonSetupTearDown):
break break
except ClientDisconnected: except ClientDisconnected:
time.sleep(0.5) time.sleep(0.5)
self._storage.close()
def checkReadOnlyClient(self): def checkReadOnlyClient(self):
# Open a read-only client to a read-write server; stores fail # Open a read-only client to a read-write server; stores fail
...@@ -242,6 +243,7 @@ class ConnectionTests(CommonSetupTearDown): ...@@ -242,6 +243,7 @@ class ConnectionTests(CommonSetupTearDown):
self._storage = self.openClientStorage(read_only=1) self._storage = self.openClientStorage(read_only=1)
# Stores should fail here # Stores should fail here
self.assertRaises(ReadOnlyError, self._dostore) self.assertRaises(ReadOnlyError, self._dostore)
self._storage.close()
def checkReadOnlyServer(self): def checkReadOnlyServer(self):
# Open a read-only client to a read-only *server*; stores fail # Open a read-only client to a read-only *server*; stores fail
...@@ -255,6 +257,7 @@ class ConnectionTests(CommonSetupTearDown): ...@@ -255,6 +257,7 @@ class ConnectionTests(CommonSetupTearDown):
self._storage = self.openClientStorage(read_only=1) self._storage = self.openClientStorage(read_only=1)
# Stores should fail here # Stores should fail here
self.assertRaises(ReadOnlyError, self._dostore) self.assertRaises(ReadOnlyError, self._dostore)
self._storage.close()
def checkReadOnlyFallbackWritable(self): def checkReadOnlyFallbackWritable(self):
# Open a fallback client to a read-write server; stores succeed # Open a fallback client to a read-write server; stores succeed
...@@ -263,6 +266,7 @@ class ConnectionTests(CommonSetupTearDown): ...@@ -263,6 +266,7 @@ class ConnectionTests(CommonSetupTearDown):
self._storage = self.openClientStorage(read_only_fallback=1) self._storage = self.openClientStorage(read_only_fallback=1)
# Stores should succeed here # Stores should succeed here
self._dostore() self._dostore()
self._storage.close()
def checkReadOnlyFallbackReadOnlyServer(self): def checkReadOnlyFallbackReadOnlyServer(self):
# Open a fallback client to a read-only *server*; stores fail # Open a fallback client to a read-only *server*; stores fail
...@@ -277,6 +281,7 @@ class ConnectionTests(CommonSetupTearDown): ...@@ -277,6 +281,7 @@ class ConnectionTests(CommonSetupTearDown):
self.assert_(self._storage.isReadOnly()) self.assert_(self._storage.isReadOnly())
# Stores should fail here # Stores should fail here
self.assertRaises(ReadOnlyError, self._dostore) self.assertRaises(ReadOnlyError, self._dostore)
self._storage.close()
# XXX Compare checkReconnectXXX() here to checkReconnection() # XXX Compare checkReconnectXXX() here to checkReconnection()
# further down. Is the code here hopelessly naive, or is # further down. Is the code here hopelessly naive, or is
...@@ -304,6 +309,7 @@ class ConnectionTests(CommonSetupTearDown): ...@@ -304,6 +309,7 @@ class ConnectionTests(CommonSetupTearDown):
self.pollUp() self.pollUp()
# Stores should succeed here # Stores should succeed here
self._dostore() self._dostore()
self._storage.close()
def checkDisconnectionError(self): def checkDisconnectionError(self):
# Make sure we get a ClientDisconnected when we try to read an # Make sure we get a ClientDisconnected when we try to read an
...@@ -313,6 +319,7 @@ class ConnectionTests(CommonSetupTearDown): ...@@ -313,6 +319,7 @@ class ConnectionTests(CommonSetupTearDown):
self._storage = self.openClientStorage('test', 1000, wait=0) self._storage = self.openClientStorage('test', 1000, wait=0)
self.assertRaises(ClientDisconnected, self.assertRaises(ClientDisconnected,
self._storage.load, 'fredwash', '') self._storage.load, 'fredwash', '')
self._storage.close()
def checkDisconnectedAbort(self): def checkDisconnectedAbort(self):
self._storage = self.openClientStorage() self._storage = self.openClientStorage()
...@@ -386,6 +393,7 @@ class ConnectionTests(CommonSetupTearDown): ...@@ -386,6 +393,7 @@ class ConnectionTests(CommonSetupTearDown):
self._storage = self.openClientStorage('test', 1000, wait=0) self._storage = self.openClientStorage('test', 1000, wait=0)
self._storage.load(oid1, '') self._storage.load(oid1, '')
self._storage.load(oid2, '') self._storage.load(oid2, '')
self._storage.close()
def checkReconnection(self): def checkReconnection(self):
# Check that the client reconnects when a server restarts. # Check that the client reconnects when a server restarts.
...@@ -464,6 +472,7 @@ class ConnectionTests(CommonSetupTearDown): ...@@ -464,6 +472,7 @@ class ConnectionTests(CommonSetupTearDown):
self._storage = self.openClientStorage() self._storage = self.openClientStorage()
self._dostore() self._dostore()
self._storage.close()
# Test case for multiple storages participating in a single # Test case for multiple storages participating in a single
# transaction. This is not really a connection test, but it needs # transaction. This is not really a connection test, but it needs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment