[Zope3-checkins] CVS: ZODB4/ZEO/tests - CommitLockTests.py:1.7 TestThread.py:NONE
Jeremy Hylton
jeremy@zope.com
Fri, 20 Dec 2002 14:54:14 -0500
Update of /cvs-repository/ZODB4/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv14804/ZEO/tests
Modified Files:
CommitLockTests.py
Removed Files:
TestThread.py
Log Message:
Move TestThread class into CommitLockTests
=== ZODB4/ZEO/tests/CommitLockTests.py 1.6 => 1.7 ===
--- ZODB4/ZEO/tests/CommitLockTests.py:1.6 Fri Nov 22 16:24:53 2002
+++ ZODB4/ZEO/tests/CommitLockTests.py Fri Dec 20 14:54:14 2002
@@ -22,13 +22,36 @@
import ZEO.ClientStorage
from ZEO.Exceptions import Disconnected
-from ZEO.tests.TestThread import TestThread
ZERO = '\0'*8
class DummyDB:
def invalidate(self, *args):
pass
+
+class TestThread(threading.Thread):
+ __super_init = threading.Thread.__init__
+ __super_run = threading.Thread.run
+
+ def __init__(self, testcase, group=None, target=None, name=None,
+ args=(), kwargs={}, verbose=None):
+ self.__super_init(group, target, name, args, kwargs, verbose)
+ self.setDaemon(1)
+ self._testcase = testcase
+
+ def run(self):
+ try:
+ self.testrun()
+ except Exception:
+ s = StringIO()
+ traceback.print_exc(file=s)
+ self._testcase.fail("Exception in thread %s:\n%s\n" %
+ (self, s.getvalue()))
+
+ def cleanup(self, timeout=15):
+ self.join(timeout)
+ if self.isAlive():
+ self._testcase.fail("Thread did not finish: %s" % self)
class WorkerThread(TestThread):
=== Removed File ZODB4/ZEO/tests/TestThread.py ===