Commit 2cb055ea authored by Vincent Pelletier's avatar Vincent Pelletier

Make runWithTimeout re-raise exception which interrupted test method.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2528 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent b49255b3
......@@ -576,9 +576,19 @@ class NEOFunctionalTest(NeoTestBase):
def runWithTimeout(self, timeout, method, args=(), kwargs=None):
if kwargs is None:
kwargs = {}
thread = threading.Thread(None, method, args=args, kwargs=kwargs)
exc_list = []
def excWrapper(*args, **kw):
try:
method(*args, **kw)
except:
exc_list.append(sys.exc_info())
thread = threading.Thread(None, excWrapper, args=args, kwargs=kwargs)
thread.setDaemon(True)
thread.start()
thread.join(timeout)
self.assertFalse(thread.isAlive(), 'Run timeout')
if exc_list:
assert len(exc_list) == 1, exc_list
exc = exc_list[0]
raise exc[0], exc[1], exc[2]
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