diff options
author | Thomas Kriechbaumer <Kriechi@users.noreply.github.com> | 2017-02-15 00:24:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-15 00:24:05 +0100 |
commit | bb2fa6dc7d871d703c6759926521d8c16aae80f1 (patch) | |
tree | 63439432d40bd5f0740000b71da0dc6df6053e3c | |
parent | a3436897ad8c504c08cff40bcddd7915c13a4712 (diff) | |
parent | 4d973e82959f5aecab8313b43ce1ab484f21b536 (diff) | |
download | mitmproxy-bb2fa6dc7d871d703c6759926521d8c16aae80f1.tar.gz mitmproxy-bb2fa6dc7d871d703c6759926521d8c16aae80f1.tar.bz2 mitmproxy-bb2fa6dc7d871d703c6759926521d8c16aae80f1.zip |
Merge pull request #2026 from Kriechi/filename-matching
add filename-matching linter
-rw-r--r-- | test/filename_matching.py | 57 | ||||
-rw-r--r-- | test/helper_tools/1024example (renamed from test/mitmproxy/tools/1024example) | 0 | ||||
-rw-r--r-- | test/helper_tools/ab.exe (renamed from test/mitmproxy/tools/ab.exe) | bin | 82944 -> 82944 bytes | |||
-rw-r--r-- | test/helper_tools/bench.py (renamed from test/mitmproxy/tools/bench.py) | 0 | ||||
-rw-r--r-- | test/helper_tools/benchtool.py (renamed from test/mitmproxy/tools/benchtool.py) | 0 | ||||
-rwxr-xr-x | test/helper_tools/dumperview.py (renamed from test/mitmproxy/addons/dumperview.py) | 0 | ||||
-rw-r--r-- | test/helper_tools/getcert (renamed from test/mitmproxy/tools/getcert) | 0 | ||||
-rw-r--r-- | test/helper_tools/inspect_dumpfile.py (renamed from test/mitmproxy/tools/inspect_dumpfile.py) | 0 | ||||
-rw-r--r-- | test/helper_tools/memoryleak.py (renamed from test/mitmproxy/tools/memoryleak.py) | 0 | ||||
-rw-r--r-- | test/helper_tools/passive_close.py (renamed from test/mitmproxy/tools/passive_close.py) | 0 | ||||
-rw-r--r-- | test/helper_tools/testpatt (renamed from test/mitmproxy/tools/testpatt) | 0 | ||||
-rw-r--r-- | test/mitmproxy/addons/onboardingapp/test_app.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/addons/test_eventstore.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/contentviews/image/__init__.py (renamed from test/mitmproxy/console/__init__.py) | 0 | ||||
-rw-r--r-- | test/mitmproxy/contentviews/image/test_image_parser.py (renamed from test/mitmproxy/contentviews/test_image_parser.py) | 0 | ||||
-rw-r--r-- | test/mitmproxy/contentviews/image/test_view.py (renamed from test/mitmproxy/contentviews/test_image.py) | 2 | ||||
-rw-r--r-- | test/mitmproxy/contentviews/test_base.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/contentviews/test_wbxml.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/contrib/test_tnetstring.py (renamed from test/mitmproxy/test_contrib_tnetstring.py) | 0 | ||||
-rw-r--r-- | test/mitmproxy/mock_urwid.py | 11 | ||||
-rw-r--r-- | test/mitmproxy/platform/test_pf.py (renamed from test/mitmproxy/test_platform_pf.py) | 0 | ||||
-rw-r--r-- | test/mitmproxy/proxy/__init__.py | 0 | ||||
-rw-r--r-- | test/mitmproxy/proxy/modes/test_http_proxy.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/proxy/modes/test_reverse_proxy.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/proxy/modes/test_socks_proxy.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/proxy/modes/test_transparent_proxy.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/proxy/protocol/__init__.py | 0 | ||||
-rw-r--r-- | test/mitmproxy/proxy/protocol/test_base.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/proxy/protocol/test_http.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/proxy/protocol/test_http1.py (renamed from test/mitmproxy/protocol/test_http1.py) | 2 | ||||
-rw-r--r-- | test/mitmproxy/proxy/protocol/test_http2.py (renamed from test/mitmproxy/protocol/test_http2.py) | 6 | ||||
-rw-r--r-- | test/mitmproxy/proxy/protocol/test_http_replay.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/proxy/protocol/test_rawtcp.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/proxy/protocol/test_tls.py (renamed from test/mitmproxy/protocol/test_tls.py) | 0 | ||||
-rw-r--r-- | test/mitmproxy/proxy/protocol/test_websocket.py (renamed from test/mitmproxy/protocol/test_websocket.py) | 10 | ||||
-rw-r--r-- | test/mitmproxy/proxy/test_config.py (renamed from test/mitmproxy/test_proxy_config.py) | 0 | ||||
-rw-r--r-- | test/mitmproxy/proxy/test_root_context.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/proxy/test_server.py (renamed from test/mitmproxy/test_server.py) | 4 | ||||
-rw-r--r-- | test/mitmproxy/test_connections.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/test_ctx.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/test_exceptions.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/test_export.py (renamed from test/mitmproxy/test_flow_export.py) | 0 | ||||
-rw-r--r-- | test/mitmproxy/test_http.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/test_io.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/test_io_compat.py (renamed from test/mitmproxy/test_flow_format_compat.py) | 0 | ||||
-rw-r--r-- | test/mitmproxy/test_log.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/test_master.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/test_options.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/test_tcp.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/test_websocket.py | 1 | ||||
-rw-r--r-- | test/mitmproxy/tools/__init__.py | 0 | ||||
-rw-r--r-- | test/mitmproxy/tools/console/__init__.py | 0 | ||||
-rw-r--r-- | test/mitmproxy/tools/console/test_common.py (renamed from test/mitmproxy/console/test_common.py) | 2 | ||||
-rw-r--r-- | test/mitmproxy/tools/console/test_help.py (renamed from test/mitmproxy/console/test_help.py) | 2 | ||||
-rw-r--r-- | test/mitmproxy/tools/console/test_master.py (renamed from test/mitmproxy/console/test_master.py) | 10 | ||||
-rw-r--r-- | test/mitmproxy/tools/console/test_palettes.py (renamed from test/mitmproxy/console/test_palettes.py) | 2 | ||||
-rw-r--r-- | test/mitmproxy/tools/console/test_pathedit.py (renamed from test/mitmproxy/console/test_pathedit.py) | 0 | ||||
-rw-r--r-- | test/mitmproxy/tools/test_cmdline.py (renamed from test/mitmproxy/test_cmdline.py) | 0 | ||||
-rw-r--r-- | test/mitmproxy/tools/test_dump.py (renamed from test/mitmproxy/test_tools_dump.py) | 2 | ||||
-rw-r--r-- | test/mitmproxy/tools/web/__init__.py | 0 | ||||
-rw-r--r-- | test/mitmproxy/tools/web/test_app.py (renamed from test/mitmproxy/test_web_app.py) | 0 | ||||
-rw-r--r-- | test/mitmproxy/tools/web/test_master.py (renamed from test/mitmproxy/test_web_master.py) | 2 | ||||
-rw-r--r-- | test/mitmproxy/utils/test_bits.py | 1 | ||||
-rw-r--r-- | test/pathod/language/__init__.py | 0 | ||||
-rw-r--r-- | test/pathod/language/test_actions.py (renamed from test/pathod/test_language_actions.py) | 0 | ||||
-rw-r--r-- | test/pathod/language/test_base.py (renamed from test/pathod/test_language_base.py) | 0 | ||||
-rw-r--r-- | test/pathod/language/test_exceptions.py | 1 | ||||
-rw-r--r-- | test/pathod/language/test_generators.py (renamed from test/pathod/test_language_generators.py) | 0 | ||||
-rw-r--r-- | test/pathod/language/test_http.py (renamed from test/pathod/test_language_http.py) | 2 | ||||
-rw-r--r-- | test/pathod/language/test_http2.py (renamed from test/pathod/test_language_http2.py) | 0 | ||||
-rw-r--r-- | test/pathod/language/test_message.py | 1 | ||||
-rw-r--r-- | test/pathod/language/test_websockets.py (renamed from test/pathod/test_language_websocket.py) | 2 | ||||
-rw-r--r-- | test/pathod/language/test_writer.py (renamed from test/pathod/test_language_writer.py) | 0 | ||||
-rw-r--r-- | test/pathod/protocols/__init__.py | 0 | ||||
-rw-r--r-- | test/pathod/protocols/test_http.py | 1 | ||||
-rw-r--r-- | test/pathod/protocols/test_http2.py (renamed from test/pathod/test_protocols_http2.py) | 4 | ||||
-rw-r--r-- | test/pathod/protocols/test_websockets.py | 1 | ||||
-rw-r--r-- | tox.ini | 5 |
78 files changed, 114 insertions, 39 deletions
diff --git a/test/filename_matching.py b/test/filename_matching.py new file mode 100644 index 00000000..51cedf03 --- /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 index 78af7ed0..78af7ed0 100644 --- a/test/mitmproxy/tools/1024example +++ b/test/helper_tools/1024example diff --git a/test/mitmproxy/tools/ab.exe b/test/helper_tools/ab.exe Binary files differindex d68ed0f3..d68ed0f3 100644 --- a/test/mitmproxy/tools/ab.exe +++ b/test/helper_tools/ab.exe diff --git a/test/mitmproxy/tools/bench.py b/test/helper_tools/bench.py index fb75ef46..fb75ef46 100644 --- a/test/mitmproxy/tools/bench.py +++ b/test/helper_tools/bench.py diff --git a/test/mitmproxy/tools/benchtool.py b/test/helper_tools/benchtool.py index b9078d0e..b9078d0e 100644 --- a/test/mitmproxy/tools/benchtool.py +++ b/test/helper_tools/benchtool.py diff --git a/test/mitmproxy/addons/dumperview.py b/test/helper_tools/dumperview.py index be56fe14..be56fe14 100755 --- a/test/mitmproxy/addons/dumperview.py +++ b/test/helper_tools/dumperview.py diff --git a/test/mitmproxy/tools/getcert b/test/helper_tools/getcert index 43ebf11d..43ebf11d 100644 --- a/test/mitmproxy/tools/getcert +++ b/test/helper_tools/getcert diff --git a/test/mitmproxy/tools/inspect_dumpfile.py b/test/helper_tools/inspect_dumpfile.py index b2201f40..b2201f40 100644 --- a/test/mitmproxy/tools/inspect_dumpfile.py +++ b/test/helper_tools/inspect_dumpfile.py diff --git a/test/mitmproxy/tools/memoryleak.py b/test/helper_tools/memoryleak.py index c03230da..c03230da 100644 --- a/test/mitmproxy/tools/memoryleak.py +++ b/test/helper_tools/memoryleak.py diff --git a/test/mitmproxy/tools/passive_close.py b/test/helper_tools/passive_close.py index 6f97ea4f..6f97ea4f 100644 --- a/test/mitmproxy/tools/passive_close.py +++ b/test/helper_tools/passive_close.py diff --git a/test/mitmproxy/tools/testpatt b/test/helper_tools/testpatt index b41011c0..b41011c0 100644 --- a/test/mitmproxy/tools/testpatt +++ b/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 00000000..777ab4dd --- /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 00000000..777ab4dd --- /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 index e69de29b..e69de29b 100644 --- a/test/mitmproxy/console/__init__.py +++ b/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 index 3c8bfdf7..3c8bfdf7 100644 --- a/test/mitmproxy/contentviews/test_image_parser.py +++ b/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 index e3dfb714..ee2f9eaa 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 00000000..777ab4dd --- /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 00000000..777ab4dd --- /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 index 05c4a7c9..05c4a7c9 100644 --- a/test/mitmproxy/test_contrib_tnetstring.py +++ b/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 9cc41abc..00000000 --- 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 index f644bcc5..f644bcc5 100644 --- a/test/mitmproxy/test_platform_pf.py +++ b/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 00000000..e69de29b --- /dev/null +++ b/test/mitmproxy/proxy/__init__.py 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 00000000..777ab4dd --- /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 00000000..777ab4dd --- /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 00000000..777ab4dd --- /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 00000000..777ab4dd --- /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 00000000..e69de29b --- /dev/null +++ b/test/mitmproxy/proxy/protocol/__init__.py diff --git a/test/mitmproxy/proxy/protocol/test_base.py b/test/mitmproxy/proxy/protocol/test_base.py new file mode 100644 index 00000000..777ab4dd --- /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 00000000..777ab4dd --- /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 index 44a9effa..07cd7dcc 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 index 8e8ba644..f5d9259d 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 00000000..777ab4dd --- /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 00000000..777ab4dd --- /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 index e17ee46f..e17ee46f 100644 --- a/test/mitmproxy/protocol/test_tls.py +++ b/test/mitmproxy/proxy/protocol/test_tls.py diff --git a/test/mitmproxy/protocol/test_websocket.py b/test/mitmproxy/proxy/protocol/test_websocket.py index 73ee8b35..4ea01d34 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 index 4272d952..4272d952 100644 --- a/test/mitmproxy/test_proxy_config.py +++ b/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 00000000..777ab4dd --- /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 index 9cd47cea..0be772a4 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 00000000..777ab4dd --- /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 00000000..777ab4dd --- /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 00000000..777ab4dd --- /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 index 457d8836..457d8836 100644 --- a/test/mitmproxy/test_flow_export.py +++ b/test/mitmproxy/test_export.py diff --git a/test/mitmproxy/test_http.py b/test/mitmproxy/test_http.py new file mode 100644 index 00000000..777ab4dd --- /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 00000000..777ab4dd --- /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 index 288de4fc..288de4fc 100644 --- a/test/mitmproxy/test_flow_format_compat.py +++ b/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 00000000..777ab4dd --- /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 00000000..777ab4dd --- /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 00000000..777ab4dd --- /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 00000000..777ab4dd --- /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 00000000..777ab4dd --- /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 00000000..e69de29b --- /dev/null +++ b/test/mitmproxy/tools/__init__.py diff --git a/test/mitmproxy/tools/console/__init__.py b/test/mitmproxy/tools/console/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/mitmproxy/tools/console/__init__.py diff --git a/test/mitmproxy/console/test_common.py b/test/mitmproxy/tools/console/test_common.py index 236ebb41..3ab4fd67 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 index 86b842d8..ac3011e6 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 index 1c89467c..0bf3734b 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 index 3892797d..1c7e1df1 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 index bd064e5f..bd064e5f 100644 --- a/test/mitmproxy/console/test_pathedit.py +++ b/test/mitmproxy/tools/console/test_pathedit.py diff --git a/test/mitmproxy/test_cmdline.py b/test/mitmproxy/tools/test_cmdline.py index 96d5ae31..96d5ae31 100644 --- a/test/mitmproxy/test_cmdline.py +++ b/test/mitmproxy/tools/test_cmdline.py diff --git a/test/mitmproxy/test_tools_dump.py b/test/mitmproxy/tools/test_dump.py index f8a88871..b4183725 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 00000000..e69de29b --- /dev/null +++ b/test/mitmproxy/tools/web/__init__.py diff --git a/test/mitmproxy/test_web_app.py b/test/mitmproxy/tools/web/test_app.py index 00dc2c7c..00dc2c7c 100644 --- a/test/mitmproxy/test_web_app.py +++ b/test/mitmproxy/tools/web/test_app.py diff --git a/test/mitmproxy/test_web_master.py b/test/mitmproxy/tools/web/test_master.py index d4190ffb..27f99a18 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 00000000..777ab4dd --- /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 00000000..e69de29b --- /dev/null +++ b/test/pathod/language/__init__.py diff --git a/test/pathod/test_language_actions.py b/test/pathod/language/test_actions.py index 9740e5c7..9740e5c7 100644 --- a/test/pathod/test_language_actions.py +++ b/test/pathod/language/test_actions.py diff --git a/test/pathod/test_language_base.py b/test/pathod/language/test_base.py index 85e9e53b..85e9e53b 100644 --- a/test/pathod/test_language_base.py +++ b/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 00000000..777ab4dd --- /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 index b3ce0335..b3ce0335 100644 --- a/test/pathod/test_language_generators.py +++ b/test/pathod/language/test_generators.py diff --git a/test/pathod/test_language_http.py b/test/pathod/language/test_http.py index 6ab43fe0..a5b35c05 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 index 4f89adb8..4f89adb8 100644 --- a/test/pathod/test_language_http2.py +++ b/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 00000000..777ab4dd --- /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 index e5046591..ed766bca 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 index 7feb985d..7feb985d 100644 --- a/test/pathod/test_language_writer.py +++ b/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 00000000..e69de29b --- /dev/null +++ b/test/pathod/protocols/__init__.py diff --git a/test/pathod/protocols/test_http.py b/test/pathod/protocols/test_http.py new file mode 100644 index 00000000..777ab4dd --- /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 index 5bb31031..1c074197 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 00000000..777ab4dd --- /dev/null +++ b/test/pathod/protocols/test_websockets.py @@ -0,0 +1 @@ +# TODO: write tests @@ -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/ \ |