diff options
| author | Maximilian Hils <git@maximilianhils.com> | 2014-02-07 04:15:24 +0100 | 
|---|---|---|
| committer | Maximilian Hils <git@maximilianhils.com> | 2014-02-07 04:15:24 +0100 | 
| commit | 9526c5d56570652400929cc33f8fb36f361eecd6 (patch) | |
| tree | 6c25603cbfc366ace56466b96da73cb258263368 /test/test_script.py | |
| parent | d07029d575532122f3d1f81141710ba36ca307e0 (diff) | |
| download | mitmproxy-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.py | 8 | 
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() | 
