diff --git a/mitmproxy/tools/main.py b/mitmproxy/tools/main.py index 568c51770..84dab1fe4 100644 --- a/mitmproxy/tools/main.py +++ b/mitmproxy/tools/main.py @@ -1,6 +1,8 @@ from __future__ import print_function # this is here for the version check to work on Python 2. import sys +# This must be at the very top, before importing anything else that might break! +# Keep all other imports below with the 'noqa' magic comment. if sys.version_info < (3, 5): print("#" * 49, file=sys.stderr) print("# mitmproxy only supports Python 3.5 and above! #", file=sys.stderr) @@ -13,7 +15,7 @@ from mitmproxy.tools import cmdline # noqa from mitmproxy import exceptions # noqa from mitmproxy import options # noqa from mitmproxy import optmanager # noqa -from mitmproxy import proxy +from mitmproxy import proxy # noqa from mitmproxy.utils import version_check # noqa from mitmproxy.utils import debug # noqa diff --git a/test/conftest.py b/test/conftest.py index 50b381971..bb9135488 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -1,8 +1,6 @@ import os import pytest import OpenSSL -import functools -from contextlib import contextmanager import mitmproxy.net.tcp diff --git a/test/mitmproxy/test_connections.py b/test/mitmproxy/test_connections.py index daf4c79ec..99367bb65 100644 --- a/test/mitmproxy/test_connections.py +++ b/test/mitmproxy/test_connections.py @@ -1,5 +1,4 @@ import socket -import os import threading import ssl import OpenSSL