From aaf82cae7d05e52d37927030adb68c94314e6110 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Tue, 2 Feb 2016 13:25:31 +0100 Subject: [PATCH] tests: use relative imports --- test/__init__.py | 1 + test/test_app.py | 3 +-- test/test_cmdline.py | 2 +- test/test_console.py | 2 +- test/test_console_common.py | 2 +- test/test_console_pathedit.py | 2 +- test/test_contentview.py | 2 +- test/test_dump.py | 2 +- test/test_examples.py | 2 +- test/test_filt.py | 2 +- test/test_flow.py | 2 +- test/test_flow_format_compat.py | 2 +- test/test_fuzzing.py | 2 +- test/test_platform_pf.py | 2 +- test/test_protocol_http.py | 3 +-- test/test_proxy.py | 2 +- test/test_script.py | 2 +- test/test_server.py | 3 +-- test/test_utils.py | 2 +- 19 files changed, 19 insertions(+), 21 deletions(-) diff --git a/test/__init__.py b/test/__init__.py index fdb35964b..61d03152d 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -1,3 +1,4 @@ +from __future__ import (print_function, absolute_import, division) # Silence third-party modules import logging diff --git a/test/test_app.py b/test/test_app.py index 8872bf530..577a70a5d 100644 --- a/test/test_app.py +++ b/test/test_app.py @@ -1,5 +1,4 @@ -import tutils -import tservers +from . import tutils, tservers class TestApp(tservers.HTTPProxTest): diff --git a/test/test_cmdline.py b/test/test_cmdline.py index bb54d011f..9b3317aa2 100644 --- a/test/test_cmdline.py +++ b/test/test_cmdline.py @@ -1,6 +1,6 @@ import argparse from libmproxy import cmdline -import tutils +from . import tutils def test_parse_replace_hook(): diff --git a/test/test_console.py b/test/test_console.py index a807d3813..e64ed44a0 100644 --- a/test/test_console.py +++ b/test/test_console.py @@ -4,7 +4,7 @@ import netlib.tutils from libmproxy import console from libmproxy.console import common -import tutils +from . import tutils class TestConsoleState: diff --git a/test/test_console_common.py b/test/test_console_common.py index 3e176d750..deba5f6c8 100644 --- a/test/test_console_common.py +++ b/test/test_console_common.py @@ -5,7 +5,7 @@ if os.name == "nt": import libmproxy.console.common as common -import tutils +from . import tutils def test_format_flow(): diff --git a/test/test_console_pathedit.py b/test/test_console_pathedit.py index 43212bc8e..940351f51 100644 --- a/test/test_console_pathedit.py +++ b/test/test_console_pathedit.py @@ -2,7 +2,7 @@ import os from os.path import normpath from libmproxy.console import pathedit -import tutils +from . import tutils class TestPathCompleter: diff --git a/test/test_contentview.py b/test/test_contentview.py index 2a70b414b..af80d63a9 100644 --- a/test/test_contentview.py +++ b/test/test_contentview.py @@ -4,7 +4,7 @@ import netlib.utils from netlib import encoding import libmproxy.contentviews as cv -import tutils +from . import tutils try: import pyamf diff --git a/test/test_dump.py b/test/test_dump.py index 110483479..dbd0c6532 100644 --- a/test/test_dump.py +++ b/test/test_dump.py @@ -8,7 +8,7 @@ from netlib.http import CONTENT_MISSING from libmproxy import dump, flow from libmproxy.proxy import Log -import tutils +from . import tutils import mock diff --git a/test/test_examples.py b/test/test_examples.py index 2a30f9d5a..bb7c596be 100644 --- a/test/test_examples.py +++ b/test/test_examples.py @@ -1,7 +1,7 @@ import glob from libmproxy import utils, script from libmproxy.proxy import config -import tservers +from . import tservers def test_load_scripts(): diff --git a/test/test_filt.py b/test/test_filt.py index 4671a2733..b1fd2ad95 100644 --- a/test/test_filt.py +++ b/test/test_filt.py @@ -3,7 +3,7 @@ from libmproxy import filt from libmproxy.protocol import http from libmproxy.models import Error from netlib.http import Headers -import tutils +from . import tutils class TestParsing: diff --git a/test/test_flow.py b/test/test_flow.py index 9775c72fe..b8d1fad31 100644 --- a/test/test_flow.py +++ b/test/test_flow.py @@ -19,7 +19,7 @@ from libmproxy.proxy.config import HostMatcher from libmproxy.proxy import ProxyConfig from libmproxy.proxy.server import DummyServer from libmproxy.models.connections import ClientConnection -import tutils +from . import tutils def test_app_registry(): diff --git a/test/test_flow_format_compat.py b/test/test_flow_format_compat.py index d64b75e71..232f54738 100644 --- a/test/test_flow_format_compat.py +++ b/test/test_flow_format_compat.py @@ -1,5 +1,5 @@ from libmproxy.flow import FlowReader, FlowReadError -import tutils +from . import tutils def test_load(): diff --git a/test/test_fuzzing.py b/test/test_fuzzing.py index c1527aa2f..cec64f585 100644 --- a/test/test_fuzzing.py +++ b/test/test_fuzzing.py @@ -1,4 +1,4 @@ -import tservers +from . import tservers """ A collection of errors turned up by fuzzing. Errors are integrated here diff --git a/test/test_platform_pf.py b/test/test_platform_pf.py index d8718c8fd..8994ee0dc 100644 --- a/test/test_platform_pf.py +++ b/test/test_platform_pf.py @@ -1,6 +1,6 @@ -import tutils import sys from libmproxy.platform import pf +from . import tutils class TestLookup: diff --git a/test/test_protocol_http.py b/test/test_protocol_http.py index 59ba6b15c..489be3f94 100644 --- a/test/test_protocol_http.py +++ b/test/test_protocol_http.py @@ -3,8 +3,7 @@ from netlib.exceptions import HttpSyntaxException from netlib.http import http1 from netlib.tcp import TCPClient from netlib.tutils import treq, raises -import tutils -import tservers +from . import tutils, tservers class TestHTTPResponse: diff --git a/test/test_proxy.py b/test/test_proxy.py index f4ce61356..27ae70a8f 100644 --- a/test/test_proxy.py +++ b/test/test_proxy.py @@ -8,9 +8,9 @@ from libmproxy.proxy.config import process_proxy_options from libmproxy.models.connections import ServerConnection from libmproxy.proxy.server import DummyServer, ProxyServer, ConnectionHandler from netlib.exceptions import TcpDisconnect -import tutils from libpathod import test from netlib.http import http1 +from . import tutils class TestServerConnection(object): diff --git a/test/test_script.py b/test/test_script.py index 11b1a64d8..f3a6499e0 100644 --- a/test/test_script.py +++ b/test/test_script.py @@ -2,7 +2,7 @@ import os import time import mock from libmproxy import script, flow -import tutils +from . import tutils def test_simple(): diff --git a/test/test_server.py b/test/test_server.py index 9a3200aa8..1b7e69662 100644 --- a/test/test_server.py +++ b/test/test_server.py @@ -16,8 +16,7 @@ from libmproxy.proxy.config import HostMatcher from libmproxy.protocol import Kill from libmproxy.models import Error, HTTPResponse -import tutils -import tservers +from . import tutils, tservers """ Note that the choice of response code in these tests matters more than you diff --git a/test/test_utils.py b/test/test_utils.py index d2bd97e14..17bf3dbff 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -1,6 +1,6 @@ import json from libmproxy import utils -import tutils +from . import tutils utils.CERT_SLEEP_TIME = 0