[Zodb-checkins] CVS: StandaloneZODB/ZEO/tests - CommitLockTests.py:1.3
Jeremy Hylton
jeremy@zope.com
Mon, 5 Aug 2002 17:55:56 -0400
Update of /cvs-repository/StandaloneZODB/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv23702
Modified Files:
CommitLockTests.py
Log Message:
Attempt to be more robust about unstoppable worker threads.
Mark each WorkerThread as a daemon. Attempt to join() it when the
test exits, but do so with a timeout. If, after the join(), the
thread is still alive, mark the test as failed. Since it's just a
daemon thread, the test program should still exit.
=== StandaloneZODB/ZEO/tests/CommitLockTests.py 1.2 => 1.3 ===
self.trans = trans
self.method = method
threading.Thread.__init__(self)
+ self.setDaemon(True)
def run(self):
try:
self.storage.tpc_begin(self.trans)
oid = self.storage.new_oid()
- self.storage.store(oid, ZERO, zodb_pickle(MinPO("c")), '', self.trans)
+ p = zodb_pickle(MinPO("c"))
+ self.storage.store(oid, ZERO, p, '', self.trans)
oid = self.storage.new_oid()
- self.storage.store(oid, ZERO, zodb_pickle(MinPO("c")), '', self.trans)
+ p = zodb_pickle(MinPO("c"))
+ self.storage.store(oid, ZERO, p, '', self.trans)
self.storage.tpc_vote(self.trans)
if self.method == "tpc_finish":
self.storage.tpc_finish(self.trans)
@@ -154,7 +157,9 @@
def _dowork2(self, method_name):
for t in self._threads:
- t.join()
+ t.join(10)
+ for t in self._threads:
+ self.failIf(t.isAlive())
def _duplicate_client(self):
"Open another ClientStorage to the same server."