Commit 4ac34f7b authored by Vincent Pelletier's avatar Vincent Pelletier

Allow passing parameters via runWithTimeout.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2175 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 8f1dd61a
...@@ -526,8 +526,10 @@ class NEOFunctionalTest(unittest.TestCase): ...@@ -526,8 +526,10 @@ class NEOFunctionalTest(unittest.TestCase):
os.makedirs(temp_dir) os.makedirs(temp_dir)
return temp_dir return temp_dir
def runWithTimeout(self, method, timeout): def runWithTimeout(self, timeout, method, args=(), kwargs=None):
thread = threading.Thread(None, method) if kwargs is None:
kwargs = {}
thread = threading.Thread(None, method, args=args, kwargs=kwargs)
thread.setDaemon(True) thread.setDaemon(True)
thread.start() thread.start()
thread.join(timeout) thread.join(timeout)
......
...@@ -252,7 +252,7 @@ class ClientTests(NEOFunctionalTest): ...@@ -252,7 +252,7 @@ class ClientTests(NEOFunctionalTest):
st2.store(oid, rev, data, '', t2) st2.store(oid, rev, data, '', t2)
# the vote will timeout as t1 never release the lock # the vote will timeout as t1 never release the lock
self.assertRaises(ConflictError, st2.tpc_vote, t2) self.assertRaises(ConflictError, st2.tpc_vote, t2)
self.runWithTimeout(test, 40) self.runWithTimeout(40, test)
def testDelayedLocksCancelled(self): def testDelayedLocksCancelled(self):
""" """
...@@ -298,7 +298,7 @@ class ClientTests(NEOFunctionalTest): ...@@ -298,7 +298,7 @@ class ClientTests(NEOFunctionalTest):
# the vote should not timeout # the vote should not timeout
st3.tpc_vote(t3) st3.tpc_vote(t3)
st3.tpc_finish(t3) st3.tpc_finish(t3)
self.runWithTimeout(test, 10) self.runWithTimeout(10, test)
def test_suite(): def test_suite():
return unittest.makeSuite(ClientTests) return unittest.makeSuite(ClientTests)
......
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