https://github.com/python/cpython/commit/f188bc38f238d7b0159772d2b2a4f6fa2d255977
commit: f188bc38f238d7b0159772d2b2a4f6fa2d255977
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2026-07-25T08:53:02+05:30
summary:

[3.15] gh-151540: Use a selector event loop in the happy-eyeballs tests 
(GH-153375) (#154623)

gh-151540: Use a selector event loop in the happy-eyeballs tests (GH-153375)
(cherry picked from commit a1ef41ab4198db28f63fda646200b14badb96513)

Co-authored-by: Jakob Rossi <[email protected]>

files:
M Lib/test/test_asyncio/test_base_events.py

diff --git a/Lib/test/test_asyncio/test_base_events.py 
b/Lib/test/test_asyncio/test_base_events.py
index e59bc25668b4cb..ffec37aaa6fe6b 100644
--- a/Lib/test/test_asyncio/test_base_events.py
+++ b/Lib/test/test_asyncio/test_base_events.py
@@ -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()
@@ -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()

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to