Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
romis2012 committed Nov 25, 2020
1 parent c04e902 commit f3a7e93
Showing 1 changed file with 6 additions and 32 deletions.
38 changes: 6 additions & 32 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@

# noinspection PyProtectedMember
from python_socks._resolver_async_aio import Resolver as AsyncioResolver
# noinspection PyProtectedMember
from python_socks._resolver_async_curio import Resolver as CurioResolver
# noinspection PyProtectedMember
from python_socks._resolver_async_trio import Resolver as TrioResolver
# noinspection PyProtectedMember
from python_socks._resolver_sync import SyncResolver
from tests.config import (
PROXY_HOST_IPV4, PROXY_HOST_IPV6,
SOCKS5_PROXY_PORT, LOGIN, PASSWORD, SKIP_IPV6_TESTS,
Expand All @@ -19,37 +13,17 @@
TEST_HOST_IPV6,
)
from tests.http_server import HttpServer, HttpServerConfig
from tests.mocks import sync_resolve_factory, async_resolve_factory
from tests.mocks import async_resolve_factory
from tests.proxy_server import ProxyConfig, ProxyServer


@pytest.fixture(scope='session', autouse=True)
def patch_resolvers():
p1 = mock.patch.object(
SyncResolver,
attribute='resolve',
new=sync_resolve_factory(SyncResolver)
)

p2 = mock.patch.object(
AsyncioResolver,
attribute='resolve',
new=async_resolve_factory(AsyncioResolver)
)

p3 = mock.patch.object(
TrioResolver,
attribute='resolve',
new=async_resolve_factory(TrioResolver)
)

p4 = mock.patch.object(
CurioResolver,
attribute='resolve',
new=async_resolve_factory(CurioResolver)
)

with p1, p2, p3, p4:
with mock.patch.object(
AsyncioResolver,
attribute='resolve',
new=async_resolve_factory(AsyncioResolver)
):
yield None


Expand Down

0 comments on commit f3a7e93

Please sign in to comment.