aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_script.py
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2014-02-07 04:15:24 +0100
committerMaximilian Hils <git@maximilianhils.com>2014-02-07 04:15:24 +0100
commit9526c5d56570652400929cc33f8fb36f361eecd6 (patch)
tree6c25603cbfc366ace56466b96da73cb258263368 /test/test_script.py
parentd07029d575532122f3d1f81141710ba36ca307e0 (diff)
downloadmitmproxy-9526c5d56570652400929cc33f8fb36f361eecd6.tar.gz
mitmproxy-9526c5d56570652400929cc33f8fb36f361eecd6.tar.bz2
mitmproxy-9526c5d56570652400929cc33f8fb36f361eecd6.zip
fix race conditions in test suite
Diffstat (limited to 'test/test_script.py')
-rw-r--r--test/test_script.py8
1 files changed, 6 insertions, 2 deletions
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()