diff options
-rw-r--r-- | mitmproxy/addons/termstatus.py | 1 | ||||
-rw-r--r-- | mitmproxy/master.py | 5 | ||||
-rw-r--r-- | mitmproxy/tools/web/master.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/proxy/protocol/test_websocket.py | 7 | ||||
-rw-r--r-- | test/mitmproxy/test_flow.py | 2 |
5 files changed, 10 insertions, 6 deletions
diff --git a/mitmproxy/addons/termstatus.py b/mitmproxy/addons/termstatus.py index 3801f320..c3c91283 100644 --- a/mitmproxy/addons/termstatus.py +++ b/mitmproxy/addons/termstatus.py @@ -1,4 +1,3 @@ -import sys from mitmproxy import ctx from mitmproxy.utils import human diff --git a/mitmproxy/master.py b/mitmproxy/master.py index 022590d4..372bb289 100644 --- a/mitmproxy/master.py +++ b/mitmproxy/master.py @@ -85,7 +85,8 @@ class Master: mitmproxy_ctx.log = None mitmproxy_ctx.options = None - def tell(self, mtype, m): + # This is a vestigial function that will go away in a refactor very soon + def tell(self, mtype, m): # pragma: no cover m.reply = controller.DummyReply() self.event_queue.put((mtype, m)) @@ -106,7 +107,7 @@ class Master: mtype, obj = await self.event_queue.get() except RuntimeError: return - if mtype not in eventsequence.Events: + if mtype not in eventsequence.Events: # pragma: no cover raise exceptions.ControlException("Unknown event %s" % repr(mtype)) self.addons.handle_lifecycle(mtype, obj) self.event_queue.task_done() diff --git a/mitmproxy/tools/web/master.py b/mitmproxy/tools/web/master.py index 843190e0..b7eddcce 100644 --- a/mitmproxy/tools/web/master.py +++ b/mitmproxy/tools/web/master.py @@ -3,7 +3,6 @@ import webbrowser import tornado.httpserver import tornado.ioloop from tornado.platform.asyncio import AsyncIOMainLoop -import asyncio from mitmproxy import addons from mitmproxy import log 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 |