Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions Lib/test/test_asyncio/test_base_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,11 @@ async def sock_connect(sock, address):
await asyncio.sleep(1)
sock.connect(address)

loop = asyncio.new_event_loop()
# gh-151540: use a selector event loop instead of the platform
# default; the Windows proactor loop would register the mocked
# socket with a real IOCP handle instead of the mocked
# _add_reader/_add_writer below.
loop = asyncio.SelectorEventLoop()
loop._add_writer = mock.Mock()
loop._add_writer = mock.Mock()
loop._add_reader = mock.Mock()
Expand Down Expand Up @@ -1124,7 +1128,8 @@ async def sock_connect(sock, address):
await asyncio.sleep(1)
sock.connect(address)

loop = asyncio.new_event_loop()
# gh-151540: see test_create_connection_happy_eyeballs above.
loop = asyncio.SelectorEventLoop()
loop._add_writer = mock.Mock()
loop._add_writer = mock.Mock()
loop._add_reader = mock.Mock()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Fix the happy-eyeballs tests in ``test.test_asyncio.test_base_events``
raising ``TypeError`` in a callback on Windows. The tests now use a
selector event loop explicitly instead of the platform default, as the
Windows proactor event loop registers the mocked test socket with a real
I/O completion port.
Loading