From 9dcd15d350aa5e2ee2d6f7299d0183cabddeb992 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Wed, 4 Apr 2018 14:52:24 +1200 Subject: asyncio: ditch the handler context There are a few reasons for this. First, logs are now async, and can be called at any time. Second, the event loop is thread local, so there can only ever be one master per thread. These two things together completely obviate the need for a handler context. --- mitmproxy/test/taddons.py | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'mitmproxy/test') diff --git a/mitmproxy/test/taddons.py b/mitmproxy/test/taddons.py index 6d439c4a..73e57456 100644 --- a/mitmproxy/test/taddons.py +++ b/mitmproxy/test/taddons.py @@ -74,7 +74,6 @@ class context: options ) self.options = self.master.options - self.wrapped = None if loadcore: self.master.addons.add(core.Core()) @@ -82,20 +81,10 @@ class context: for a in addons: self.master.addons.add(a) - def ctx(self): - """ - Returns a new handler context. - """ - return self.master.handlecontext() - def __enter__(self): - self.wrapped = self.ctx() - self.wrapped.__enter__() return self def __exit__(self, exc_type, exc_value, traceback): - self.wrapped.__exit__(exc_type, exc_value, traceback) - self.wrapped = None return False @contextlib.contextmanager -- cgit v1.2.3