Skip to content

Commit

Permalink
[PR #9371/c25099c backport][3.11] Reduce indent in connector tests (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Oct 1, 2024
1 parent dc080fd commit 224345e
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions tests/test_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,9 +728,15 @@ def get_extra_info(param):

assert False

conn._loop.create_connection = create_connection

with mock.patch(
with mock.patch.object(
conn, "_resolve_host", autospec=True, spec_set=True, side_effect=_resolve_host
), mock.patch.object(
conn._loop,
"create_connection",
autospec=True,
spec_set=True,
side_effect=create_connection,
), mock.patch(
"aiohttp.connector.aiohappyeyeballs.start_connection", start_connection
):
established_connection = await conn.connect(req, [], ClientTimeout())
Expand Down Expand Up @@ -880,9 +886,15 @@ async def create_connection(*args, **kwargs):
pr = create_mocked_conn(loop)
return tr, pr

conn._loop.create_connection = create_connection

with mock.patch(
with mock.patch.object(
conn, "_resolve_host", autospec=True, spec_set=True, side_effect=_resolve_host
), mock.patch.object(
conn._loop,
"create_connection",
autospec=True,
spec_set=True,
side_effect=create_connection,
), mock.patch(
"aiohttp.connector.aiohappyeyeballs.start_connection", start_connection
):
established_connection = await conn.connect(req, [], ClientTimeout())
Expand Down

0 comments on commit 224345e

Please sign in to comment.