aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2018-04-02 15:47:23 +1200
committerAldo Cortesi <aldo@nullcube.com>2018-04-02 16:41:49 +1200
commit14f461c5d59e95e84658ea43567b3ca9f7d0a108 (patch)
tree1e76216ac2a1a86c237dee2e1ed89cba87224cb1 /test
parent1f33c1c1a54e466f903cc69a2e086d699515cad8 (diff)
downloadmitmproxy-14f461c5d59e95e84658ea43567b3ca9f7d0a108.tar.gz
mitmproxy-14f461c5d59e95e84658ea43567b3ca9f7d0a108.tar.bz2
mitmproxy-14f461c5d59e95e84658ea43567b3ca9f7d0a108.zip
asyncio: cleanup and lint
Also fix a racy websocket test.
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/proxy/protocol/test_websocket.py7
-rw-r--r--test/mitmproxy/test_flow.py2
2 files changed, 7 insertions, 2 deletions
diff --git a/test/mitmproxy/proxy/protocol/test_websocket.py b/test/mitmproxy/proxy/protocol/test_websocket.py
index 014490b7..f64f500c 100644
--- a/test/mitmproxy/proxy/protocol/test_websocket.py
+++ b/test/mitmproxy/proxy/protocol/test_websocket.py
@@ -331,7 +331,12 @@ class TestPong(_WebSocketTest):
assert frame.header.opcode == websockets.OPCODE.PONG
assert frame.payload == b'foobar'
- assert self.master.has_log("Pong Received from server", "info")
+ for i in range(20):
+ if self.master.has_log("Pong Received from server", "info"):
+ break
+ time.sleep(0.01)
+ else:
+ raise AssertionError("No pong seen")
class TestClose(_WebSocketTest):
diff --git a/test/mitmproxy/test_flow.py b/test/mitmproxy/test_flow.py
index 9f1fb213..4042de5b 100644
--- a/test/mitmproxy/test_flow.py
+++ b/test/mitmproxy/test_flow.py
@@ -7,7 +7,7 @@ import mitmproxy.io
from mitmproxy import flowfilter
from mitmproxy import options
from mitmproxy.io import tnetstring
-from mitmproxy.exceptions import FlowReadException, ReplayException, ControlException
+from mitmproxy.exceptions import FlowReadException, ReplayException
from mitmproxy import flow
from mitmproxy import http
from mitmproxy.net import http as net_http