Commit 8375ad9f authored by Jeremy Hylton's avatar Jeremy Hylton

Merge updates for Windows test success from the trunk

parent b7e27555
...@@ -222,10 +222,12 @@ class ConnectionTests(ZEOTestBase): ...@@ -222,10 +222,12 @@ class ConnectionTests(ZEOTestBase):
start and stop a ZEO storage server. start and stop a ZEO storage server.
""" """
ports = range(29000, 30000, 10) # enough for 100 tests __super_setUp = StorageTestBase.StorageTestBase.setUp
random.shuffle(ports)
__super_tearDown = StorageTestBase.StorageTestBase.tearDown ports = []
for i in range(200):
ports.append(random.randrange(25000, 30000))
del i
def openClientStorage(self, cache='', cache_size=200000, wait=1): def openClientStorage(self, cache='', cache_size=200000, wait=1):
# defined by subclasses # defined by subclasses
...@@ -302,11 +304,16 @@ class ConnectionTests(ZEOTestBase): ...@@ -302,11 +304,16 @@ class ConnectionTests(ZEOTestBase):
while 1: while 1:
try: try:
revid1 = self._dostore(oid, data=obj) revid1 = self._dostore(oid, data=obj)
except (ClientDisconnected, thread.error), err: except (ClientDisconnected, thread.error, socket.error), err:
get_transaction().abort() get_transaction().abort()
time.sleep(0.1) time.sleep(0.1)
else: else:
break break
# XXX This is a bloody pain. We're placing a heavy burden
# on users to catch a plethora of exceptions in order to
# write robust code. Need to think about implementing
# John Heintz's suggestion to make sure all exceptions
# inherit from POSException.
class UnixConnectionTests(ConnectionTests): class UnixConnectionTests(ConnectionTests):
__super_setUp = StorageTestBase.StorageTestBase.setUp __super_setUp = StorageTestBase.StorageTestBase.setUp
...@@ -405,20 +412,15 @@ else: ...@@ -405,20 +412,15 @@ else:
def makeTestSuite(testname=''): def makeTestSuite(testname=''):
suite = unittest.TestSuite() suite = unittest.TestSuite()
name = 'check' + testname name = 'check' + testname
for klass in ZEOFileStorageTests, ConnectionTests: lname = len(name)
for klass in test_classes:
for meth in get_methods(klass): for meth in get_methods(klass):
if meth.startswith(name): if meth[:lname] == name:
suite.addTest(klass(meth)) suite.addTest(klass(meth))
return suite return suite
def test_suite(): def test_suite():
t = unittest.TestLoader() return makeTestSuite()
t.testMethodPrefix = 'check'
tests = []
for klass in test_classes:
s = t.loadTestsFromTestCase(klass)
tests.extend(s._tests)
return unittest.TestSuite(tests)
def main(): def main():
import sys, getopt import sys, getopt
......
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