diff --git a/test/filename_matching.py b/test/filename_matching.py new file mode 100644 index 000000000..51cedf03c --- /dev/null +++ b/test/filename_matching.py @@ -0,0 +1,57 @@ +import os +import re +import glob +import sys + + +def check_src_files_have_test(): + missing_test_files = [] + + excluded = ['mitmproxy/contrib/', 'mitmproxy/test/', 'mitmproxy/tools/', 'mitmproxy/platform/'] + src_files = glob.glob('mitmproxy/**/*.py', recursive=True) + glob.glob('pathod/**/*.py', recursive=True) + src_files = [f for f in src_files if os.path.basename(f) != '__init__.py'] + src_files = [f for f in src_files if not any(os.path.normpath(p) in f for p in excluded)] + for f in src_files: + p = os.path.join("test", os.path.dirname(f), "test_" + os.path.basename(f)) + if not os.path.isfile(p): + missing_test_files.append((f, p)) + + return missing_test_files + + +def check_test_files_have_src(): + unknown_test_files = [] + + excluded = ['test/mitmproxy/data/', 'test/mitmproxy/net/data/', '/tservers.py'] + test_files = glob.glob('test/mitmproxy/**/*.py', recursive=True) + glob.glob('test/pathod/**/*.py', recursive=True) + test_files = [f for f in test_files if os.path.basename(f) != '__init__.py'] + test_files = [f for f in test_files if not any(os.path.normpath(p) in f for p in excluded)] + for f in test_files: + p = os.path.join(re.sub('^test/', '', os.path.dirname(f)), re.sub('^test_', '', os.path.basename(f))) + if not os.path.isfile(p): + unknown_test_files.append((f, p)) + + return unknown_test_files + + +def main(): + exitcode = 0 + + missing_test_files = check_src_files_have_test() + if missing_test_files: + exitcode += 1 + for f, p in sorted(missing_test_files): + print("{} MUST have a matching test file: {}".format(f, p)) + + unknown_test_files = check_test_files_have_src() + if unknown_test_files: + # TODO: enable this in the future + # exitcode += 1 + for f, p in sorted(unknown_test_files): + print("{} DOES NOT MATCH a source file! Expected to find: {}".format(f, p)) + + sys.exit(exitcode) + + +if __name__ == '__main__': + main() diff --git a/test/mitmproxy/tools/1024example b/test/helper_tools/1024example similarity index 100% rename from test/mitmproxy/tools/1024example rename to test/helper_tools/1024example diff --git a/test/mitmproxy/tools/ab.exe b/test/helper_tools/ab.exe similarity index 100% rename from test/mitmproxy/tools/ab.exe rename to test/helper_tools/ab.exe diff --git a/test/mitmproxy/tools/bench.py b/test/helper_tools/bench.py similarity index 100% rename from test/mitmproxy/tools/bench.py rename to test/helper_tools/bench.py diff --git a/test/mitmproxy/tools/benchtool.py b/test/helper_tools/benchtool.py similarity index 100% rename from test/mitmproxy/tools/benchtool.py rename to test/helper_tools/benchtool.py diff --git a/test/mitmproxy/addons/dumperview.py b/test/helper_tools/dumperview.py similarity index 100% rename from test/mitmproxy/addons/dumperview.py rename to test/helper_tools/dumperview.py diff --git a/test/mitmproxy/tools/getcert b/test/helper_tools/getcert similarity index 100% rename from test/mitmproxy/tools/getcert rename to test/helper_tools/getcert diff --git a/test/mitmproxy/tools/inspect_dumpfile.py b/test/helper_tools/inspect_dumpfile.py similarity index 100% rename from test/mitmproxy/tools/inspect_dumpfile.py rename to test/helper_tools/inspect_dumpfile.py diff --git a/test/mitmproxy/tools/memoryleak.py b/test/helper_tools/memoryleak.py similarity index 100% rename from test/mitmproxy/tools/memoryleak.py rename to test/helper_tools/memoryleak.py diff --git a/test/mitmproxy/tools/passive_close.py b/test/helper_tools/passive_close.py similarity index 100% rename from test/mitmproxy/tools/passive_close.py rename to test/helper_tools/passive_close.py diff --git a/test/mitmproxy/tools/testpatt b/test/helper_tools/testpatt similarity index 100% rename from test/mitmproxy/tools/testpatt rename to test/helper_tools/testpatt diff --git a/test/mitmproxy/addons/onboardingapp/test_app.py b/test/mitmproxy/addons/onboardingapp/test_app.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/addons/onboardingapp/test_app.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/addons/test_eventstore.py b/test/mitmproxy/addons/test_eventstore.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/addons/test_eventstore.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/console/__init__.py b/test/mitmproxy/contentviews/image/__init__.py similarity index 100% rename from test/mitmproxy/console/__init__.py rename to test/mitmproxy/contentviews/image/__init__.py diff --git a/test/mitmproxy/contentviews/test_image_parser.py b/test/mitmproxy/contentviews/image/test_image_parser.py similarity index 100% rename from test/mitmproxy/contentviews/test_image_parser.py rename to test/mitmproxy/contentviews/image/test_image_parser.py diff --git a/test/mitmproxy/contentviews/test_image.py b/test/mitmproxy/contentviews/image/test_view.py similarity index 94% rename from test/mitmproxy/contentviews/test_image.py rename to test/mitmproxy/contentviews/image/test_view.py index e3dfb714a..ee2f9eaa1 100644 --- a/test/mitmproxy/contentviews/test_image.py +++ b/test/mitmproxy/contentviews/image/test_view.py @@ -1,6 +1,6 @@ from mitmproxy.contentviews import image from mitmproxy.test import tutils -from . import full_eval +from .. import full_eval def test_view_image(): diff --git a/test/mitmproxy/contentviews/test_base.py b/test/mitmproxy/contentviews/test_base.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/contentviews/test_base.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/contentviews/test_wbxml.py b/test/mitmproxy/contentviews/test_wbxml.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/contentviews/test_wbxml.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/test_contrib_tnetstring.py b/test/mitmproxy/contrib/test_tnetstring.py similarity index 100% rename from test/mitmproxy/test_contrib_tnetstring.py rename to test/mitmproxy/contrib/test_tnetstring.py diff --git a/test/mitmproxy/mock_urwid.py b/test/mitmproxy/mock_urwid.py deleted file mode 100644 index 9cc41abc7..000000000 --- a/test/mitmproxy/mock_urwid.py +++ /dev/null @@ -1,11 +0,0 @@ -import os -import sys -from unittest import mock - -if os.name == "nt": - m = mock.Mock() - m.__version__ = "1.1.1" - m.Widget = mock.Mock - m.WidgetWrap = mock.Mock - sys.modules['urwid'] = m - sys.modules['urwid.util'] = mock.Mock() diff --git a/test/mitmproxy/test_platform_pf.py b/test/mitmproxy/platform/test_pf.py similarity index 100% rename from test/mitmproxy/test_platform_pf.py rename to test/mitmproxy/platform/test_pf.py diff --git a/test/mitmproxy/proxy/__init__.py b/test/mitmproxy/proxy/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/test/mitmproxy/proxy/modes/test_http_proxy.py b/test/mitmproxy/proxy/modes/test_http_proxy.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/proxy/modes/test_http_proxy.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/proxy/modes/test_reverse_proxy.py b/test/mitmproxy/proxy/modes/test_reverse_proxy.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/proxy/modes/test_reverse_proxy.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/proxy/modes/test_socks_proxy.py b/test/mitmproxy/proxy/modes/test_socks_proxy.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/proxy/modes/test_socks_proxy.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/proxy/modes/test_transparent_proxy.py b/test/mitmproxy/proxy/modes/test_transparent_proxy.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/proxy/modes/test_transparent_proxy.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/proxy/protocol/__init__.py b/test/mitmproxy/proxy/protocol/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/test/mitmproxy/proxy/protocol/test_base.py b/test/mitmproxy/proxy/protocol/test_base.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/proxy/protocol/test_base.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/proxy/protocol/test_http.py b/test/mitmproxy/proxy/protocol/test_http.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/proxy/protocol/test_http.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/protocol/test_http1.py b/test/mitmproxy/proxy/protocol/test_http1.py similarity index 98% rename from test/mitmproxy/protocol/test_http1.py rename to test/mitmproxy/proxy/protocol/test_http1.py index 44a9effa3..07cd7dcc0 100644 --- a/test/mitmproxy/protocol/test_http1.py +++ b/test/mitmproxy/proxy/protocol/test_http1.py @@ -2,7 +2,7 @@ from mitmproxy.test import tflow from mitmproxy.net.http import http1 from mitmproxy.net.tcp import TCPClient from mitmproxy.test.tutils import treq -from .. import tservers +from ... import tservers class TestHTTPFlow: diff --git a/test/mitmproxy/protocol/test_http2.py b/test/mitmproxy/proxy/protocol/test_http2.py similarity index 99% rename from test/mitmproxy/protocol/test_http2.py rename to test/mitmproxy/proxy/protocol/test_http2.py index 8e8ba6448..f5d9259da 100644 --- a/test/mitmproxy/protocol/test_http2.py +++ b/test/mitmproxy/proxy/protocol/test_http2.py @@ -11,12 +11,12 @@ from mitmproxy import options from mitmproxy.proxy.config import ProxyConfig import mitmproxy.net -from ...mitmproxy.net import tservers as net_tservers +from ....mitmproxy.net import tservers as net_tservers from mitmproxy import exceptions from mitmproxy.net.http import http1, http2 -from .. import tservers -from ...conftest import requires_alpn +from ... import tservers +from ....conftest import requires_alpn import logging logging.getLogger("hyper.packages.hpack.hpack").setLevel(logging.WARNING) diff --git a/test/mitmproxy/proxy/protocol/test_http_replay.py b/test/mitmproxy/proxy/protocol/test_http_replay.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/proxy/protocol/test_http_replay.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/proxy/protocol/test_rawtcp.py b/test/mitmproxy/proxy/protocol/test_rawtcp.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/proxy/protocol/test_rawtcp.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/protocol/test_tls.py b/test/mitmproxy/proxy/protocol/test_tls.py similarity index 100% rename from test/mitmproxy/protocol/test_tls.py rename to test/mitmproxy/proxy/protocol/test_tls.py diff --git a/test/mitmproxy/protocol/test_websocket.py b/test/mitmproxy/proxy/protocol/test_websocket.py similarity index 97% rename from test/mitmproxy/protocol/test_websocket.py rename to test/mitmproxy/proxy/protocol/test_websocket.py index 73ee8b35b..4ea01d34d 100644 --- a/test/mitmproxy/protocol/test_websocket.py +++ b/test/mitmproxy/proxy/protocol/test_websocket.py @@ -9,17 +9,17 @@ from mitmproxy.http import HTTPFlow from mitmproxy.websocket import WebSocketFlow from mitmproxy.proxy.config import ProxyConfig -import mitmproxy.net +from mitmproxy.net import tcp from mitmproxy.net import http -from ...mitmproxy.net import tservers as net_tservers -from .. import tservers +from ....mitmproxy.net import tservers as net_tservers +from ... import tservers from mitmproxy.net import websockets class _WebSocketServerBase(net_tservers.ServerTestBase): - class handler(mitmproxy.net.tcp.BaseHandler): + class handler(tcp.BaseHandler): def handle(self): try: @@ -80,7 +80,7 @@ class _WebSocketTestBase: self.server.server.handle_websockets = self.handle_websockets def _setup_connection(self): - client = mitmproxy.net.tcp.TCPClient(("127.0.0.1", self.proxy.port)) + client = tcp.TCPClient(("127.0.0.1", self.proxy.port)) client.connect() request = http.Request( diff --git a/test/mitmproxy/test_proxy_config.py b/test/mitmproxy/proxy/test_config.py similarity index 100% rename from test/mitmproxy/test_proxy_config.py rename to test/mitmproxy/proxy/test_config.py diff --git a/test/mitmproxy/proxy/test_root_context.py b/test/mitmproxy/proxy/test_root_context.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/proxy/test_root_context.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/test_server.py b/test/mitmproxy/proxy/test_server.py similarity index 99% rename from test/mitmproxy/test_server.py rename to test/mitmproxy/proxy/test_server.py index 9cd47ceaf..0be772a41 100644 --- a/test/mitmproxy/test_server.py +++ b/test/mitmproxy/proxy/test_server.py @@ -21,8 +21,8 @@ from mitmproxy.net.tcp import Address from pathod import pathoc from pathod import pathod -from . import tservers -from ..conftest import skip_appveyor +from .. import tservers +from ...conftest import skip_appveyor """ diff --git a/test/mitmproxy/test_connections.py b/test/mitmproxy/test_connections.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/test_connections.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/test_ctx.py b/test/mitmproxy/test_ctx.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/test_ctx.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/test_exceptions.py b/test/mitmproxy/test_exceptions.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/test_exceptions.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/test_flow_export.py b/test/mitmproxy/test_export.py similarity index 100% rename from test/mitmproxy/test_flow_export.py rename to test/mitmproxy/test_export.py diff --git a/test/mitmproxy/test_http.py b/test/mitmproxy/test_http.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/test_http.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/test_io.py b/test/mitmproxy/test_io.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/test_io.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/test_flow_format_compat.py b/test/mitmproxy/test_io_compat.py similarity index 100% rename from test/mitmproxy/test_flow_format_compat.py rename to test/mitmproxy/test_io_compat.py diff --git a/test/mitmproxy/test_log.py b/test/mitmproxy/test_log.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/test_log.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/test_master.py b/test/mitmproxy/test_master.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/test_master.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/test_options.py b/test/mitmproxy/test_options.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/test_options.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/test_tcp.py b/test/mitmproxy/test_tcp.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/test_tcp.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/test_websocket.py b/test/mitmproxy/test_websocket.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/test_websocket.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/mitmproxy/tools/__init__.py b/test/mitmproxy/tools/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/test/mitmproxy/tools/console/__init__.py b/test/mitmproxy/tools/console/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/test/mitmproxy/console/test_common.py b/test/mitmproxy/tools/console/test_common.py similarity index 88% rename from test/mitmproxy/console/test_common.py rename to test/mitmproxy/tools/console/test_common.py index 236ebb416..3ab4fd677 100644 --- a/test/mitmproxy/console/test_common.py +++ b/test/mitmproxy/tools/console/test_common.py @@ -1,7 +1,7 @@ from mitmproxy.test import tflow from mitmproxy.tools.console import common -from ...conftest import skip_appveyor +from ....conftest import skip_appveyor @skip_appveyor diff --git a/test/mitmproxy/console/test_help.py b/test/mitmproxy/tools/console/test_help.py similarity index 90% rename from test/mitmproxy/console/test_help.py rename to test/mitmproxy/tools/console/test_help.py index 86b842d8b..ac3011e6f 100644 --- a/test/mitmproxy/console/test_help.py +++ b/test/mitmproxy/tools/console/test_help.py @@ -1,6 +1,6 @@ import mitmproxy.tools.console.help as help -from ...conftest import skip_appveyor +from ....conftest import skip_appveyor @skip_appveyor diff --git a/test/mitmproxy/console/test_master.py b/test/mitmproxy/tools/console/test_master.py similarity index 83% rename from test/mitmproxy/console/test_master.py rename to test/mitmproxy/tools/console/test_master.py index 1c89467cb..0bf3734b2 100644 --- a/test/mitmproxy/console/test_master.py +++ b/test/mitmproxy/tools/console/test_master.py @@ -1,10 +1,10 @@ from mitmproxy.test import tflow -import mitmproxy.test.tutils +from mitmproxy.test import tutils from mitmproxy.tools import console from mitmproxy import proxy from mitmproxy import options from mitmproxy.tools.console import common -from .. import tservers +from ... import tservers def test_format_keyvals(): @@ -45,12 +45,12 @@ class TestMaster(tservers.MasterTest): def test_intercept(self): """regression test for https://github.com/mitmproxy/mitmproxy/issues/1605""" m = self.mkmaster(intercept="~b bar") - f = tflow.tflow(req=mitmproxy.test.tutils.treq(content=b"foo")) + f = tflow.tflow(req=tutils.treq(content=b"foo")) m.request(f) assert not m.view[0].intercepted - f = tflow.tflow(req=mitmproxy.test.tutils.treq(content=b"bar")) + f = tflow.tflow(req=tutils.treq(content=b"bar")) m.request(f) assert m.view[1].intercepted - f = tflow.tflow(resp=mitmproxy.test.tutils.tresp(content=b"bar")) + f = tflow.tflow(resp=tutils.tresp(content=b"bar")) m.request(f) assert m.view[2].intercepted diff --git a/test/mitmproxy/console/test_palettes.py b/test/mitmproxy/tools/console/test_palettes.py similarity index 87% rename from test/mitmproxy/console/test_palettes.py rename to test/mitmproxy/tools/console/test_palettes.py index 3892797d5..1c7e1df12 100644 --- a/test/mitmproxy/console/test_palettes.py +++ b/test/mitmproxy/tools/console/test_palettes.py @@ -1,6 +1,6 @@ import mitmproxy.tools.console.palettes as palettes -from ...conftest import skip_appveyor +from ....conftest import skip_appveyor @skip_appveyor diff --git a/test/mitmproxy/console/test_pathedit.py b/test/mitmproxy/tools/console/test_pathedit.py similarity index 100% rename from test/mitmproxy/console/test_pathedit.py rename to test/mitmproxy/tools/console/test_pathedit.py diff --git a/test/mitmproxy/test_cmdline.py b/test/mitmproxy/tools/test_cmdline.py similarity index 100% rename from test/mitmproxy/test_cmdline.py rename to test/mitmproxy/tools/test_cmdline.py diff --git a/test/mitmproxy/test_tools_dump.py b/test/mitmproxy/tools/test_dump.py similarity index 98% rename from test/mitmproxy/test_tools_dump.py rename to test/mitmproxy/tools/test_dump.py index f8a888717..b4183725b 100644 --- a/test/mitmproxy/test_tools_dump.py +++ b/test/mitmproxy/tools/test_dump.py @@ -8,7 +8,7 @@ from mitmproxy import controller from mitmproxy.tools import dump from mitmproxy.test import tutils -from . import tservers +from .. import tservers class TestDumpMaster(tservers.MasterTest): diff --git a/test/mitmproxy/tools/web/__init__.py b/test/mitmproxy/tools/web/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/test/mitmproxy/test_web_app.py b/test/mitmproxy/tools/web/test_app.py similarity index 100% rename from test/mitmproxy/test_web_app.py rename to test/mitmproxy/tools/web/test_app.py diff --git a/test/mitmproxy/test_web_master.py b/test/mitmproxy/tools/web/test_master.py similarity index 95% rename from test/mitmproxy/test_web_master.py rename to test/mitmproxy/tools/web/test_master.py index d4190ffb7..27f99a187 100644 --- a/test/mitmproxy/test_web_master.py +++ b/test/mitmproxy/tools/web/test_master.py @@ -3,7 +3,7 @@ from mitmproxy import proxy from mitmproxy import options from mitmproxy.proxy.config import ProxyConfig -from . import tservers +from ... import tservers class TestWebMaster(tservers.MasterTest): diff --git a/test/mitmproxy/utils/test_bits.py b/test/mitmproxy/utils/test_bits.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/mitmproxy/utils/test_bits.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/pathod/language/__init__.py b/test/pathod/language/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/test/pathod/test_language_actions.py b/test/pathod/language/test_actions.py similarity index 100% rename from test/pathod/test_language_actions.py rename to test/pathod/language/test_actions.py diff --git a/test/pathod/test_language_base.py b/test/pathod/language/test_base.py similarity index 100% rename from test/pathod/test_language_base.py rename to test/pathod/language/test_base.py diff --git a/test/pathod/language/test_exceptions.py b/test/pathod/language/test_exceptions.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/pathod/language/test_exceptions.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/pathod/test_language_generators.py b/test/pathod/language/test_generators.py similarity index 100% rename from test/pathod/test_language_generators.py rename to test/pathod/language/test_generators.py diff --git a/test/pathod/test_language_http.py b/test/pathod/language/test_http.py similarity index 99% rename from test/pathod/test_language_http.py rename to test/pathod/language/test_http.py index 6ab43fe0d..a5b35c05a 100644 --- a/test/pathod/test_language_http.py +++ b/test/pathod/language/test_http.py @@ -4,7 +4,7 @@ import pytest from pathod import language from pathod.language import http, base -from . import tservers +from .. import tservers def parse_request(s): diff --git a/test/pathod/test_language_http2.py b/test/pathod/language/test_http2.py similarity index 100% rename from test/pathod/test_language_http2.py rename to test/pathod/language/test_http2.py diff --git a/test/pathod/language/test_message.py b/test/pathod/language/test_message.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/pathod/language/test_message.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/pathod/test_language_websocket.py b/test/pathod/language/test_websockets.py similarity index 99% rename from test/pathod/test_language_websocket.py rename to test/pathod/language/test_websockets.py index e50465919..ed766bca6 100644 --- a/test/pathod/test_language_websocket.py +++ b/test/pathod/language/test_websockets.py @@ -4,7 +4,7 @@ from pathod import language from pathod.language import websockets import mitmproxy.net.websockets -from . import tservers +from .. import tservers def parse_request(s): diff --git a/test/pathod/test_language_writer.py b/test/pathod/language/test_writer.py similarity index 100% rename from test/pathod/test_language_writer.py rename to test/pathod/language/test_writer.py diff --git a/test/pathod/protocols/__init__.py b/test/pathod/protocols/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/test/pathod/protocols/test_http.py b/test/pathod/protocols/test_http.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/pathod/protocols/test_http.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/test/pathod/test_protocols_http2.py b/test/pathod/protocols/test_http2.py similarity index 99% rename from test/pathod/test_protocols_http2.py rename to test/pathod/protocols/test_http2.py index 5bb31031e..1c074197b 100644 --- a/test/pathod/test_protocols_http2.py +++ b/test/pathod/protocols/test_http2.py @@ -7,11 +7,11 @@ from mitmproxy.net import tcp, http from mitmproxy.net.http import http2 from mitmproxy import exceptions -from ..mitmproxy.net import tservers as net_tservers +from ...mitmproxy.net import tservers as net_tservers from pathod.protocols.http2 import HTTP2StateProtocol, TCPHandler -from ..conftest import requires_alpn +from ...conftest import requires_alpn class TestTCPHandlerWrapper: diff --git a/test/pathod/protocols/test_websockets.py b/test/pathod/protocols/test_websockets.py new file mode 100644 index 000000000..777ab4dd1 --- /dev/null +++ b/test/pathod/protocols/test_websockets.py @@ -0,0 +1 @@ +# TODO: write tests diff --git a/tox.ini b/tox.ini index 7bd33dda0..1c5e1b963 100644 --- a/tox.ini +++ b/tox.ini @@ -29,9 +29,10 @@ commands = sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html [testenv:lint] commands = mitmdump --version - flake8 --jobs 8 --count mitmproxy pathod examples test release + flake8 --jobs 8 mitmproxy pathod examples test release + python3 test/filename_matching.py rstcheck README.rst - mypy --silent-imports \ + mypy --ignore-missing-imports --follow-imports=skip \ mitmproxy/addons/ \ mitmproxy/addonmanager.py \ mitmproxy/proxy/protocol/ \