Commit 3e4762b3 authored by Jeremy Hylton's avatar Jeremy Hylton

Remove dependence on StorageTestBase setUp() and tearDown().

parent 7de001c5
...@@ -61,7 +61,7 @@ if hasattr(FileStorage, 'supportsTransactionalUndo'): ...@@ -61,7 +61,7 @@ if hasattr(FileStorage, 'supportsTransactionalUndo'):
else: else:
class VersionDependentTests: class VersionDependentTests:
pass pass
class GenericTests(ZEOTestBase, class GenericTests(ZEOTestBase,
VersionDependentTests, VersionDependentTests,
Cache.StorageWithCache, Cache.StorageWithCache,
...@@ -80,16 +80,12 @@ class GenericTests(ZEOTestBase, ...@@ -80,16 +80,12 @@ class GenericTests(ZEOTestBase,
returns a specific storage, e.g. FileStorage. returns a specific storage, e.g. FileStorage.
""" """
__super_setUp = StorageTestBase.StorageTestBase.setUp
__super_tearDown = StorageTestBase.StorageTestBase.tearDown
def setUp(self): def setUp(self):
"""Start a ZEO server using a Unix domain socket """Start a ZEO server using a Unix domain socket
The ZEO server uses the storage object returned by the The ZEO server uses the storage object returned by the
getStorage() method. getStorage() method.
""" """
self.__super_setUp()
self.running = 1 self.running = 1
client, exit, pid = forker.start_zeo(self.getStorage()) client, exit, pid = forker.start_zeo(self.getStorage())
self._pid = pid self._pid = pid
...@@ -100,10 +96,10 @@ class GenericTests(ZEOTestBase, ...@@ -100,10 +96,10 @@ class GenericTests(ZEOTestBase,
def tearDown(self): def tearDown(self):
"""Try to cause the tests to halt""" """Try to cause the tests to halt"""
self.running = 0 self.running = 0
self._storage.close()
self._server.close() self._server.close()
os.waitpid(self._pid, 0) os.waitpid(self._pid, 0)
self.delStorage() self.delStorage()
self.__super_tearDown()
def checkLargeUpdate(self): def checkLargeUpdate(self):
obj = MinPO("X" * (10 * 128 * 1024)) obj = MinPO("X" * (10 * 128 * 1024))
...@@ -138,11 +134,8 @@ class WindowsGenericTests(GenericTests): ...@@ -138,11 +134,8 @@ class WindowsGenericTests(GenericTests):
can't be created in the parent process and passed to the child. can't be created in the parent process and passed to the child.
All the work has to be done in the server's process. All the work has to be done in the server's process.
""" """
__super_setUp = StorageTestBase.StorageTestBase.setUp
__super_tearDown = StorageTestBase.StorageTestBase.tearDown
def setUp(self): def setUp(self):
self.__super_setUp()
args = self.getStorageInfo() args = self.getStorageInfo()
name = args[0] name = args[0]
args = args[1:] args = args[1:]
...@@ -162,7 +155,6 @@ class WindowsGenericTests(GenericTests): ...@@ -162,7 +155,6 @@ class WindowsGenericTests(GenericTests):
## os.waitpid(self.test_pid, 0) ## os.waitpid(self.test_pid, 0)
time.sleep(0.5) time.sleep(0.5)
self.delStorage() self.delStorage()
self.__super_tearDown()
class WindowsZEOFileStorageTests(WindowsGenericTests): class WindowsZEOFileStorageTests(WindowsGenericTests):
...@@ -186,8 +178,6 @@ class ConnectionTests(ZEOTestBase): ...@@ -186,8 +178,6 @@ class ConnectionTests(ZEOTestBase):
start and stop a ZEO storage server. start and stop a ZEO storage server.
""" """
__super_tearDown = StorageTestBase.StorageTestBase.tearDown
ports = [] ports = []
for i in range(200): for i in range(200):
ports.append(random.randrange(25000, 30000)) ports.append(random.randrange(25000, 30000))
...@@ -203,6 +193,7 @@ class ConnectionTests(ZEOTestBase): ...@@ -203,6 +193,7 @@ class ConnectionTests(ZEOTestBase):
def tearDown(self): def tearDown(self):
"""Try to cause the tests to halt""" """Try to cause the tests to halt"""
self._storage.close()
self.shutdownServer() self.shutdownServer()
# file storage appears to create four files # file storage appears to create four files
for ext in '', '.index', '.lock', '.tmp': for ext in '', '.index', '.lock', '.tmp':
...@@ -213,7 +204,6 @@ class ConnectionTests(ZEOTestBase): ...@@ -213,7 +204,6 @@ class ConnectionTests(ZEOTestBase):
path = "c1-test-%d.zec" % i path = "c1-test-%d.zec" % i
if os.path.exists(path): if os.path.exists(path):
os.unlink(path) os.unlink(path)
self.__super_tearDown()
def checkBasicPersistence(self): def checkBasicPersistence(self):
"""Verify cached data persists across client storage instances. """Verify cached data persists across client storage instances.
......
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