Commit 9533ce76 authored by Jason Madden's avatar Jason Madden

Bound the amount of time we wait for the client thread to exit.

parent e454ce4d
...@@ -11,3 +11,4 @@ exclude_lines = ...@@ -11,3 +11,4 @@ exclude_lines =
pragma: no cover pragma: no cover
if __name__ == ['"]__main__['"]: if __name__ == ['"]__main__['"]:
assert False assert False
self.fail
...@@ -7,6 +7,8 @@ import ZODB ...@@ -7,6 +7,8 @@ import ZODB
class ZODBClientThread(threading.Thread): class ZODBClientThread(threading.Thread):
sleep_time = 15
def __init__(self, db, test): def __init__(self, db, test):
threading.Thread.__init__(self) threading.Thread.__init__(self)
self._exc_info = None self._exc_info = None
...@@ -19,7 +21,7 @@ class ZODBClientThread(threading.Thread): ...@@ -19,7 +21,7 @@ class ZODBClientThread(threading.Thread):
conn = self.db.open() conn = self.db.open()
conn.sync() conn.sync()
self.event.set() self.event.set()
time.sleep(15) time.sleep(self.sleep_time)
# conn.close calls self.transaction_manager.unregisterSynch(self) # conn.close calls self.transaction_manager.unregisterSynch(self)
# and this succeeds. # and this succeeds.
...@@ -50,8 +52,11 @@ class ShutdownTest(ZODB.tests.util.TestCase): ...@@ -50,8 +52,11 @@ class ShutdownTest(ZODB.tests.util.TestCase):
# have different contents. # have different contents.
self._db.close() self._db.close()
# Be sure not to 'leak' the running thread. # Be sure not to 'leak' the running thread; if it hasn't
client_thread.join() # finished after this, something went very wrong
client_thread.join(client_thread.sleep_time + 10)
if client_thread.is_alive():
self.fail("Client thread failed to close connection")
def test_suite(): def test_suite():
......
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