From 9526c5d56570652400929cc33f8fb36f361eecd6 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Fri, 7 Feb 2014 04:15:24 +0100 Subject: fix race conditions in test suite --- test/test_script.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'test/test_script.py') diff --git a/test/test_script.py b/test/test_script.py index 2999a910..13903066 100644 --- a/test/test_script.py +++ b/test/test_script.py @@ -86,13 +86,17 @@ class TestScript: f.reply = f.request.reply with mock.patch("libmproxy.controller.DummyReply.__call__") as m: + t_start = time.time() s.run("clientconnect", f) s.run("serverconnect", f) s.run("response", f) s.run("error", f) s.run("clientdisconnect", f) - time.sleep(0.1) - assert m.call_count == 5 + while (time.time() - t_start) < 1 and m.call_count <= 5: + if m.call_count == 5: + return + time.sleep(0.001) + assert False def test_concurrent_err(self): s = flow.State() -- cgit v1.2.3