Skip to content

Commit a1ef41a

Browse files
authored
gh-151540: Use a selector event loop in the happy-eyeballs tests (#153375)
1 parent 93128f5 commit a1ef41a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

Lib/test/test_asyncio/test_base_events.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,11 @@ async def sock_connect(sock, address):
10921092
await asyncio.sleep(1)
10931093
sock.connect(address)
10941094

1095-
loop = asyncio.new_event_loop()
1095+
# gh-151540: use a selector event loop instead of the platform
1096+
# default; the Windows proactor loop would register the mocked
1097+
# socket with a real IOCP handle instead of the mocked
1098+
# _add_reader/_add_writer below.
1099+
loop = asyncio.SelectorEventLoop()
10961100
loop._add_writer = mock.Mock()
10971101
loop._add_writer = mock.Mock()
10981102
loop._add_reader = mock.Mock()
@@ -1124,7 +1128,8 @@ async def sock_connect(sock, address):
11241128
await asyncio.sleep(1)
11251129
sock.connect(address)
11261130

1127-
loop = asyncio.new_event_loop()
1131+
# gh-151540: see test_create_connection_happy_eyeballs above.
1132+
loop = asyncio.SelectorEventLoop()
11281133
loop._add_writer = mock.Mock()
11291134
loop._add_writer = mock.Mock()
11301135
loop._add_reader = mock.Mock()

0 commit comments

Comments
 (0)