`isort` everything except lib (for now) (#952)

* isort the tests folder

* Carry over changes from #672

* Disable pre-commit

* Revert flake8 config change

* isort examples too
This commit is contained in:
Abhinav Singh 2022-01-10 13:28:22 +05:30 committed by GitHub
parent 9344a54fbe
commit 35e9c57af7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
44 changed files with 217 additions and 168 deletions

24
.isort.cfg Normal file
View File

@ -0,0 +1,24 @@
# https://github.com/timothycrosley/isort/wiki/isort-Settings
[settings]
default_section = THIRDPARTY
# force_to_top=file1.py,file2.py
# forced_separate = django.contrib,django.utils
include_trailing_comma = true
indent = 4
known_first_party = proxy
# known_future_library = future,pies
# known_standard_library = std,std2
known_testing = pytest,unittest
length_sort = 1
# Should be: 80 - 1
line_length = 79
lines_after_imports = 2
# https://pycqa.github.io/isort/docs/configuration/multi_line_output_modes.html
# NOTE: Another mode could be "5" for grouping multiple "import from" under
# NOTE: a single instruction.
multi_line_output = 5
no_lines_before = LOCALFOLDER
sections=FUTURE,STDLIB,TESTING,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
# skip=file3.py,file4.py
use_parentheses = true
verbose = true

View File

@ -8,7 +8,7 @@ repos:
- --py36-plus
# - repo: https://github.com/timothycrosley/isort.git
# rev: 5.4.2
# rev: 5.10.0
# hooks:
# - id: isort
# args:

View File

@ -10,10 +10,11 @@
"""
import sys
import subprocess
from pathlib import Path
from proxy.common.version import __version__ as lib_version
# This script ensures our versions never run out of sync.
#
# 1. TODO: Version is hardcoded in homebrew stable package

View File

@ -9,17 +9,13 @@
:license: BSD, see LICENSE for more details.
"""
import time
from typing import Any, Optional
from proxy import Proxy
from proxy.http.responses import (
PROXY_TUNNEL_ESTABLISHED_RESPONSE_PKT,
PROXY_TUNNEL_UNSUPPORTED_SCHEME,
)
from proxy.core.base import BaseTcpTunnelHandler
from proxy.http.responses import (
PROXY_TUNNEL_UNSUPPORTED_SCHEME, PROXY_TUNNEL_ESTABLISHED_RESPONSE_PKT,
)
class HttpsConnectTunnelHandler(BaseTcpTunnelHandler):

View File

@ -9,13 +9,15 @@
:license: BSD, see LICENSE for more details.
"""
import time
import multiprocessing
import logging
import multiprocessing
from typing import Any, Dict, Optional
from typing import Dict, Any, Optional
from proxy.core.event import (
EventQueue, EventManager, EventSubscriber, eventNames,
)
from proxy.common.constants import DEFAULT_LOG_FORMAT
from proxy.core.event import EventManager, EventQueue, EventSubscriber, eventNames
logging.basicConfig(level=logging.DEBUG, format=DEFAULT_LOG_FORMAT)

View File

@ -13,6 +13,7 @@ import logging
from proxy.core.connection import TcpServerConnection
from proxy.common.constants import DEFAULT_BUFFER_SIZE
logger = logging.getLogger(__name__)
if __name__ == '__main__':

View File

@ -12,11 +12,10 @@ import time
from typing import Optional
from proxy import Proxy
from proxy.core.base import BaseTcpServerHandler
from proxy.common.utils import wrap_socket
from proxy.core.connection import TcpClientConnection
from proxy.core.base import BaseTcpServerHandler
class EchoSSLServerHandler(BaseTcpServerHandler):
"""Wraps client socket during initialization."""

View File

@ -13,6 +13,7 @@ import logging
from proxy.common.utils import socket_connection
from proxy.common.constants import DEFAULT_BUFFER_SIZE
logger = logging.getLogger(__name__)
if __name__ == '__main__':

View File

@ -11,9 +11,9 @@
import time
from proxy import Proxy
from proxy.common.types import Readables, Writables, SelectableEvents
from proxy.core.acceptor import Work
from proxy.core.connection import TcpClientConnection
from proxy.common.types import Readables, SelectableEvents, Writables
class WebScraper(Work[TcpClientConnection]):

View File

@ -11,7 +11,10 @@
import time
import logging
from proxy.http.websocket import WebsocketClient, WebsocketFrame, websocketOpcodes
from proxy.http.websocket import (
WebsocketFrame, WebsocketClient, websocketOpcodes,
)
# globals
client: WebsocketClient

View File

@ -12,4 +12,5 @@ import logging
from proxy.common.constants import DEFAULT_LOG_FORMAT
logging.basicConfig(level=logging.DEBUG, format=DEFAULT_LOG_FORMAT)

View File

@ -8,16 +8,15 @@
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE for more details.
"""
from typing import Dict, List
import unittest
from unittest import mock
from typing import List, Dict
from proxy.plugin import CacheResponsesPlugin, FilterByUpstreamHostPlugin
from proxy.http.proxy import HttpProxyPlugin
from proxy.plugin import CacheResponsesPlugin
from proxy.plugin import FilterByUpstreamHostPlugin
from proxy.common.utils import bytes_
from proxy.common.flag import FlagParser
from proxy.common.utils import bytes_
from proxy.common.version import __version__
from proxy.common.constants import PLUGIN_HTTP_PROXY, PY2_DEPRECATION_MESSAGE

View File

@ -10,11 +10,12 @@
"""
import os
import tempfile
import unittest
import subprocess
from unittest import mock
from typing import Tuple
import unittest
from unittest import mock
from proxy.common import pki

View File

@ -9,12 +9,15 @@
:license: BSD, see LICENSE for more details.
"""
import socket
import unittest
from unittest import mock
from proxy.common.constants import DEFAULT_IPV6_HOSTNAME, DEFAULT_IPV4_HOSTNAME, DEFAULT_PORT, DEFAULT_TIMEOUT
from proxy.common.constants import DEFAULT_HTTP_PORT
from proxy.common.utils import new_socket_connection, socket_connection
from proxy.common.utils import socket_connection, new_socket_connection
from proxy.common.constants import (
DEFAULT_PORT, DEFAULT_TIMEOUT, DEFAULT_HTTP_PORT, DEFAULT_IPV4_HOSTNAME,
DEFAULT_IPV6_HOSTNAME,
)
class TestSocketConnectionUtils(unittest.TestCase):

View File

@ -8,14 +8,15 @@
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE for more details.
"""
import unittest
import socket
import selectors
import multiprocessing
import unittest
from unittest import mock
from proxy.core.acceptor import Acceptor
from proxy.common.flag import FlagParser
from proxy.core.acceptor import Acceptor
class TestAcceptor(unittest.TestCase):

View File

@ -9,7 +9,6 @@
:license: BSD, see LICENSE for more details.
"""
import unittest
from unittest import mock
from proxy.common.flag import FlagParser

View File

@ -8,11 +8,12 @@
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE for more details.
"""
import pytest
import unittest
import selectors
import pytest
import unittest
from unittest import mock
from pytest_mock import MockerFixture
from proxy.core.connection import UpstreamConnectionPool

View File

@ -8,15 +8,20 @@
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE for more details.
"""
import unittest
import socket
import ssl
from unittest import mock
from typing import Optional, Union
import socket
from typing import Union, Optional
from proxy.core.connection import tcpConnectionTypes, TcpConnectionUninitializedException
from proxy.core.connection import TcpServerConnection, TcpConnection, TcpClientConnection
from proxy.common.constants import DEFAULT_IPV6_HOSTNAME, DEFAULT_PORT, DEFAULT_IPV4_HOSTNAME
import unittest
from unittest import mock
from proxy.core.connection import (
TcpConnection, TcpClientConnection, TcpServerConnection,
TcpConnectionUninitializedException, tcpConnectionTypes,
)
from proxy.common.constants import (
DEFAULT_PORT, DEFAULT_IPV4_HOSTNAME, DEFAULT_IPV6_HOSTNAME,
)
class TestTcpConnection(unittest.TestCase):

View File

@ -9,16 +9,15 @@
:license: BSD, see LICENSE for more details.
"""
import os
import threading
import unittest
import queue
import threading
import multiprocessing
from multiprocessing import connection
import unittest
from unittest import mock
from proxy.core.event import EventDispatcher, EventQueue, eventNames
from proxy.core.event import EventQueue, EventDispatcher, eventNames
class TestEventDispatcher(unittest.TestCase):

View File

@ -9,7 +9,6 @@
:license: BSD, see LICENSE for more details.
"""
import unittest
from unittest import mock
from proxy.core.event import EventManager

View File

@ -8,11 +8,11 @@
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE for more details.
"""
import multiprocessing
import os
import threading
import unittest
import multiprocessing
import unittest
from unittest import mock
from proxy.core.event import EventQueue, eventNames

View File

@ -11,13 +11,16 @@
import os
import queue
import threading
import unittest
import multiprocessing
from typing import Dict, Any
from typing import Any, Dict
import unittest
from unittest import mock
from proxy.core.event import EventQueue, EventDispatcher, EventSubscriber, eventNames
from proxy.core.event import (
EventQueue, EventDispatcher, EventSubscriber, eventNames,
)
PUBLISHER_ID = threading.get_ident()

View File

@ -11,15 +11,14 @@
import os
import socket
import tempfile
import unittest
from unittest import mock
import pytest
import unittest
from unittest import mock
from proxy.common.flag import FlagParser
from proxy.core.acceptor import Listener
from proxy.common.constants import IS_WINDOWS
from proxy.common.flag import FlagParser
class TestListener(unittest.TestCase):

View File

@ -8,17 +8,17 @@
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE for more details.
"""
import pytest
import selectors
import pytest
from pytest_mock import MockerFixture
from proxy.common.flag import FlagParser
from proxy.http import HttpProtocolHandler, httpHeaders
from proxy.common.flag import FlagParser
from proxy.common.utils import build_http_request
from proxy.http.responses import PROXY_AUTH_FAILED_RESPONSE_PKT
from proxy.core.connection import TcpClientConnection
from proxy.common.utils import build_http_request
from ...test_assertions import Assertions

View File

@ -12,9 +12,9 @@ import unittest
from proxy.http import httpStatusCodes
from proxy.http.parser import HttpParser, httpParserTypes
from proxy.common.utils import build_http_response
from proxy.http.exception import HttpRequestRejected
from proxy.common.constants import CRLF
from proxy.common.utils import build_http_response
class TestHttpRequestRejected(unittest.TestCase):

View File

@ -10,7 +10,7 @@
"""
import unittest
from proxy.http.parser import chunkParserStates, ChunkParser
from proxy.http.parser import ChunkParser, chunkParserStates
class TestChunkParser(unittest.TestCase):

View File

@ -8,11 +8,12 @@
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE for more details.
"""
import httpx
import pytest
from proxy.common.constants import IS_WINDOWS
import httpx
from proxy import TestCase
from proxy.common.constants import IS_WINDOWS
class TestHttp2WithProxy(TestCase):

View File

@ -10,14 +10,14 @@
"""
import unittest
from proxy.common.constants import CRLF, HTTP_1_0
from proxy.common.utils import build_http_request, build_http_header
from proxy.common.utils import find_http_line, bytes_
from proxy.http import httpMethods
from proxy.http.exception import HttpProtocolException
from proxy.http.parser import HttpParser, httpParserTypes, httpParserStates
from proxy.common.utils import (
bytes_, find_http_line, build_http_header, build_http_request,
)
from proxy.http.exception import HttpProtocolException
from proxy.http.responses import okResponse
from proxy.common.constants import CRLF, HTTP_1_0
class TestHttpParser(unittest.TestCase):

View File

@ -8,18 +8,19 @@
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE for more details.
"""
import pytest
import selectors
import pytest
from pytest_mock import MockerFixture
from proxy.common.constants import DEFAULT_HTTP_PORT
from proxy.common.flag import FlagParser
from proxy.core.connection import TcpClientConnection
from proxy.http.proxy import HttpProxyPlugin
from proxy.http import HttpProtocolHandler
from proxy.http.exception import HttpProtocolException
from proxy.http.proxy import HttpProxyPlugin
from proxy.common.flag import FlagParser
from proxy.common.utils import build_http_request
from proxy.http.exception import HttpProtocolException
from proxy.core.connection import TcpClientConnection
from proxy.common.constants import DEFAULT_HTTP_PORT
class TestHttpProxyPlugin:

View File

@ -11,21 +11,21 @@
import ssl
import uuid
import socket
import pytest
import selectors
from typing import Any
from pytest_mock import MockerFixture
from unittest import mock
from proxy.common.constants import DEFAULT_CA_FILE
from proxy.common.utils import build_http_request, bytes_
from proxy.common.flag import FlagParser
import pytest
from unittest import mock
from pytest_mock import MockerFixture
from proxy.http import HttpProtocolHandler, httpMethods
from proxy.http.proxy import HttpProxyPlugin
from proxy.common.flag import FlagParser
from proxy.common.utils import bytes_, build_http_request
from proxy.http.responses import PROXY_TUNNEL_ESTABLISHED_RESPONSE_PKT
from proxy.core.connection import TcpClientConnection, TcpServerConnection
from proxy.common.constants import DEFAULT_CA_FILE
from ..test_assertions import Assertions

View File

@ -9,29 +9,29 @@
:license: BSD, see LICENSE for more details.
"""
import base64
import pytest
import selectors
from typing import Any, cast
import pytest
from unittest import mock
from pytest_mock import MockerFixture
from typing import cast, Any
from proxy.common.plugins import Plugins
from proxy.common.flag import FlagParser
from proxy.common.version import __version__
from proxy.common.utils import bytes_
from proxy.common.constants import CRLF, PLUGIN_HTTP_PROXY, PLUGIN_PROXY_AUTH, PLUGIN_WEB_SERVER
from proxy.core.connection import TcpClientConnection
from proxy.http.parser import HttpParser
from pytest_mock import MockerFixture
from proxy.http import HttpProtocolHandler, httpHeaders
from proxy.http.proxy import HttpProxyPlugin
from proxy.common.flag import FlagParser
from proxy.http.parser import HttpParser, httpParserTypes, httpParserStates
from proxy.common.utils import bytes_
from proxy.common.plugins import Plugins
from proxy.common.version import __version__
from proxy.http.responses import (
BAD_GATEWAY_RESPONSE_PKT,
PROXY_AUTH_FAILED_RESPONSE_PKT,
BAD_GATEWAY_RESPONSE_PKT, PROXY_AUTH_FAILED_RESPONSE_PKT,
PROXY_TUNNEL_ESTABLISHED_RESPONSE_PKT,
)
from proxy.http.parser import httpParserStates, httpParserTypes
from proxy.http import HttpProtocolHandler, httpHeaders
from proxy.core.connection import TcpClientConnection
from proxy.common.constants import (
CRLF, PLUGIN_HTTP_PROXY, PLUGIN_PROXY_AUTH, PLUGIN_WEB_SERVER,
)
from ..test_assertions import Assertions

View File

@ -10,7 +10,7 @@
"""
import unittest
from proxy.http.parser import ProxyProtocol, PROXY_PROTOCOL_V2_SIGNATURE
from proxy.http.parser import PROXY_PROTOCOL_V2_SIGNATURE, ProxyProtocol
from proxy.http.exception import HttpProtocolException

View File

@ -9,11 +9,11 @@
:license: BSD, see LICENSE for more details.
"""
import re
import unittest
import binascii
from pathlib import Path
import unittest
from proxy.http.parser.tls import TlsParser, tlsContentType, tlsHandshakeType

View File

@ -10,23 +10,24 @@
"""
import os
import gzip
import pytest
import tempfile
import selectors
from typing import Any
import pytest
from pytest_mock import MockerFixture
# from unittest import mock
from proxy.common.plugins import Plugins
from proxy.common.flag import FlagParser
from proxy.core.connection import TcpClientConnection
from proxy.http import HttpProtocolHandler
from proxy.http.parser import HttpParser, httpParserStates, httpParserTypes
from proxy.common.utils import build_http_response, build_http_request, bytes_
from proxy.common.constants import CRLF, PLUGIN_HTTP_PROXY, PLUGIN_PAC_FILE, PLUGIN_WEB_SERVER, PROXY_PY_DIR
from proxy.common.flag import FlagParser
from proxy.http.parser import HttpParser, httpParserTypes, httpParserStates
from proxy.common.utils import bytes_, build_http_request, build_http_response
from proxy.common.plugins import Plugins
from proxy.http.responses import NOT_FOUND_RESPONSE_PKT
from proxy.core.connection import TcpClientConnection
from proxy.common.constants import (
CRLF, PROXY_PY_DIR, PLUGIN_PAC_FILE, PLUGIN_HTTP_PROXY, PLUGIN_WEB_SERVER,
)
from ..test_assertions import Assertions

View File

@ -11,8 +11,10 @@
import unittest
from unittest import mock
from proxy.common.utils import build_websocket_handshake_response, build_websocket_handshake_request
from proxy.http.websocket import WebsocketClient, WebsocketFrame
from proxy.common.utils import (
build_websocket_handshake_request, build_websocket_handshake_response,
)
from proxy.http.websocket import WebsocketFrame, WebsocketClient
from proxy.common.constants import DEFAULT_PORT

View File

@ -11,12 +11,12 @@
Test the simplest proxy use scenario for smoke.
"""
import time
import pytest
import tempfile
from typing import Any, Generator
from pathlib import Path
from subprocess import check_output, Popen
from typing import Generator, Any
from subprocess import Popen, check_output
import pytest
from proxy.common.constants import IS_WINDOWS

View File

@ -10,27 +10,25 @@
"""
import gzip
import json
import pytest
import selectors
from pathlib import Path
from unittest import mock
from typing import cast, Any
from typing import Any, cast
from urllib import parse as urlparse
from pathlib import Path
import pytest
from unittest import mock
from pytest_mock import MockerFixture
from proxy.common.flag import FlagParser
from proxy.core.connection import TcpClientConnection
from proxy.http import HttpProtocolHandler
from proxy.http import httpStatusCodes
from proxy.http.proxy import HttpProxyPlugin
from proxy.http.parser import HttpParser, httpParserTypes
from proxy.common.utils import build_http_request, bytes_, build_http_response
from proxy.common.constants import PROXY_AGENT_HEADER_VALUE, DEFAULT_HTTP_PORT
from proxy.http import HttpProtocolHandler, httpStatusCodes
from proxy.plugin import ProposedRestApiPlugin, RedirectToCustomServerPlugin
from proxy.http.proxy import HttpProxyPlugin
from proxy.common.flag import FlagParser
from proxy.http.parser import HttpParser, httpParserTypes
from proxy.common.utils import bytes_, build_http_request, build_http_response
from proxy.core.connection import TcpClientConnection
from proxy.common.constants import DEFAULT_HTTP_PORT, PROXY_AGENT_HEADER_VALUE
from .utils import get_plugin_by_test_name
from ..test_assertions import Assertions

View File

@ -11,23 +11,23 @@
import ssl
import gzip
import socket
import pytest
import selectors
from pytest_mock import MockerFixture
from typing import Any, cast
from proxy.common.flag import FlagParser
from proxy.common.utils import bytes_, build_http_request
from proxy.core.connection import TcpClientConnection, TcpServerConnection
import pytest
from proxy.http import httpMethods, HttpProtocolHandler
from pytest_mock import MockerFixture
from proxy.http import HttpProtocolHandler, httpMethods
from proxy.http.proxy import HttpProxyPlugin
from proxy.common.flag import FlagParser
from proxy.http.parser import HttpParser, httpParserTypes
from proxy.http.responses import PROXY_TUNNEL_ESTABLISHED_RESPONSE_PKT, okResponse
from proxy.common.utils import bytes_, build_http_request
from proxy.http.responses import (
PROXY_TUNNEL_ESTABLISHED_RESPONSE_PKT, okResponse,
)
from proxy.core.connection import TcpClientConnection, TcpServerConnection
from .utils import get_plugin_by_test_name
from ..test_assertions import Assertions

View File

@ -9,10 +9,13 @@
:license: BSD, see LICENSE for more details.
"""
from typing import Type
from proxy.http.proxy import HttpProxyBasePlugin
from proxy.plugin import ModifyPostDataPlugin, ProposedRestApiPlugin, RedirectToCustomServerPlugin, \
FilterByUpstreamHostPlugin, CacheResponsesPlugin, ManInTheMiddlePlugin, FilterByURLRegexPlugin
from proxy.plugin import (
CacheResponsesPlugin, ManInTheMiddlePlugin, ModifyPostDataPlugin,
ProposedRestApiPlugin, FilterByURLRegexPlugin, FilterByUpstreamHostPlugin,
RedirectToCustomServerPlugin,
)
from proxy.http.proxy import HttpProxyBasePlugin
def get_plugin_by_test_name(test_name: str) -> Type[HttpProxyBasePlugin]:

View File

@ -18,15 +18,15 @@
* https://github.com/pytest-dev/pytest/blob/d18c75b/testing/test_meta.py
* https://twitter.com/codewithanthony/status/1229445110510735361
"""
from itertools import chain
from pathlib import Path
from types import ModuleType
from typing import Generator, List
import os
import sys
import pkgutil
import subprocess
import sys
from types import ModuleType
from typing import List, Generator
from pathlib import Path
from itertools import chain
import pytest
import proxy

View File

@ -10,24 +10,28 @@
"""
import os
import tempfile
import unittest
import unittest
from unittest import mock
from proxy.proxy import main, entry_point
from proxy.common.constants import DEFAULT_PORT_FILE, _env_threadless_compliant # noqa: WPS450
from proxy.common.utils import bytes_
from proxy.common.constants import DEFAULT_ENABLE_DASHBOARD, DEFAULT_LOCAL_EXECUTOR, DEFAULT_LOG_LEVEL, DEFAULT_LOG_FILE
from proxy.common.constants import DEFAULT_TIMEOUT, DEFAULT_DEVTOOLS_WS_PATH, DEFAULT_DISABLE_HTTP_PROXY
from proxy.common.constants import DEFAULT_ENABLE_STATIC_SERVER, DEFAULT_ENABLE_EVENTS, DEFAULT_ENABLE_DEVTOOLS
from proxy.common.constants import DEFAULT_ENABLE_WEB_SERVER, DEFAULT_THREADLESS, DEFAULT_CERT_FILE, DEFAULT_KEY_FILE
from proxy.common.constants import DEFAULT_CA_CERT_FILE, DEFAULT_CA_KEY_FILE, DEFAULT_CA_SIGNING_KEY_FILE
from proxy.common.constants import DEFAULT_PAC_FILE, DEFAULT_PLUGINS, DEFAULT_PID_FILE, DEFAULT_PORT, DEFAULT_BASIC_AUTH
from proxy.common.constants import DEFAULT_NUM_WORKERS, DEFAULT_OPEN_FILE_LIMIT, DEFAULT_IPV6_HOSTNAME
from proxy.common.constants import DEFAULT_SERVER_RECVBUF_SIZE, DEFAULT_CLIENT_RECVBUF_SIZE, DEFAULT_WORK_KLASS
from proxy.common.constants import PLUGIN_INSPECT_TRAFFIC, PLUGIN_DASHBOARD, PLUGIN_DEVTOOLS_PROTOCOL, PLUGIN_WEB_SERVER
from proxy.common.constants import PLUGIN_HTTP_PROXY, DEFAULT_NUM_ACCEPTORS, PLUGIN_PROXY_AUTH, DEFAULT_LOG_FORMAT
from proxy.common.constants import ( # noqa: WPS450
DEFAULT_PORT, DEFAULT_PLUGINS, DEFAULT_TIMEOUT, DEFAULT_KEY_FILE,
DEFAULT_LOG_FILE, DEFAULT_PAC_FILE, DEFAULT_PID_FILE, PLUGIN_DASHBOARD,
DEFAULT_CERT_FILE, DEFAULT_LOG_LEVEL, DEFAULT_PORT_FILE, PLUGIN_HTTP_PROXY,
PLUGIN_PROXY_AUTH, PLUGIN_WEB_SERVER, DEFAULT_BASIC_AUTH,
DEFAULT_LOG_FORMAT, DEFAULT_THREADLESS, DEFAULT_WORK_KLASS,
DEFAULT_CA_KEY_FILE, DEFAULT_NUM_WORKERS, DEFAULT_CA_CERT_FILE,
DEFAULT_ENABLE_EVENTS, DEFAULT_IPV6_HOSTNAME, DEFAULT_NUM_ACCEPTORS,
DEFAULT_LOCAL_EXECUTOR, PLUGIN_INSPECT_TRAFFIC, DEFAULT_ENABLE_DEVTOOLS,
DEFAULT_OPEN_FILE_LIMIT, DEFAULT_DEVTOOLS_WS_PATH,
DEFAULT_ENABLE_DASHBOARD, PLUGIN_DEVTOOLS_PROTOCOL,
DEFAULT_ENABLE_WEB_SERVER, DEFAULT_DISABLE_HTTP_PROXY,
DEFAULT_CA_SIGNING_KEY_FILE, DEFAULT_CLIENT_RECVBUF_SIZE,
DEFAULT_SERVER_RECVBUF_SIZE, DEFAULT_ENABLE_STATIC_SERVER,
_env_threadless_compliant,
)
class TestMain(unittest.TestCase):

View File

@ -8,13 +8,13 @@
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE for more details.
"""
import pytest
import unittest
from unittest import mock
import pytest
from proxy.common.constants import IS_WINDOWS
from proxy.common.utils import set_open_file_limit
from proxy.common.constants import IS_WINDOWS
if not IS_WINDOWS:
import resource

View File

@ -9,16 +9,18 @@
:license: BSD, see LICENSE for more details.
"""
import http.client
import urllib.request
import urllib.error
import urllib.request
import pytest
from proxy import TestCase
from proxy.common.constants import DEFAULT_CLIENT_RECVBUF_SIZE, PROXY_AGENT_HEADER_VALUE, IS_WINDOWS
from proxy.common.utils import socket_connection, build_http_request
from proxy.http import httpMethods
from proxy.common.utils import socket_connection, build_http_request
from proxy.http.responses import NOT_FOUND_RESPONSE_PKT
from proxy.common.constants import (
IS_WINDOWS, PROXY_AGENT_HEADER_VALUE, DEFAULT_CLIENT_RECVBUF_SIZE,
)
@pytest.mark.skipif(

View File

@ -9,8 +9,8 @@
:license: BSD, see LICENSE for more details.
"""
import unittest
import proxy
import proxy
from proxy.common.utils import get_available_port