diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2018-04-04 14:52:24 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@corte.si> | 2018-04-07 09:04:14 +1200 |
commit | 9dcd15d350aa5e2ee2d6f7299d0183cabddeb992 (patch) | |
tree | b02a58edf7402c3f0f9a898a71d9e384bea4ecf2 /mitmproxy/test | |
parent | 6a08ef465f3af6cb2044baf98279de1071538f5a (diff) | |
download | mitmproxy-9dcd15d350aa5e2ee2d6f7299d0183cabddeb992.tar.gz mitmproxy-9dcd15d350aa5e2ee2d6f7299d0183cabddeb992.tar.bz2 mitmproxy-9dcd15d350aa5e2ee2d6f7299d0183cabddeb992.zip |
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.
Diffstat (limited to 'mitmproxy/test')
-rw-r--r-- | mitmproxy/test/taddons.py | 11 |
1 files changed, 0 insertions, 11 deletions
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 |