https://github.com/python/cpython/commit/f7c7decc4c7c10084ab3c1473e1a590666d3ea17
commit: f7c7decc4c7c10084ab3c1473e1a590666d3ea17
branch: main
author: Kumar Aditya <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2025-02-09T18:36:16+05:30
summary:
gh-129874: improve test_events to use correct task implementation (#129891)
files:
M Lib/test/test_asyncio/test_events.py
diff --git a/Lib/test/test_asyncio/test_events.py
b/Lib/test/test_asyncio/test_events.py
index ada049e9c7d387..3838993fa8c6a9 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -2930,11 +2930,16 @@ class GetEventLoopTestsMixin:
get_running_loop_impl = None
get_event_loop_impl = None
+ Task = None
+ Future = None
+
def setUp(self):
self._get_running_loop_saved = events._get_running_loop
self._set_running_loop_saved = events._set_running_loop
self.get_running_loop_saved = events.get_running_loop
self.get_event_loop_saved = events.get_event_loop
+ self._Task_saved = asyncio.Task
+ self._Future_saved = asyncio.Future
events._get_running_loop = type(self)._get_running_loop_impl
events._set_running_loop = type(self)._set_running_loop_impl
@@ -2946,6 +2951,8 @@ def setUp(self):
asyncio.get_running_loop = type(self).get_running_loop_impl
asyncio.get_event_loop = type(self).get_event_loop_impl
+ asyncio.Task = asyncio.tasks.Task = type(self).Task
+ asyncio.Future = asyncio.futures.Future = type(self).Future
super().setUp()
self.loop = asyncio.new_event_loop()
@@ -2968,8 +2975,10 @@ def tearDown(self):
asyncio.get_running_loop = self.get_running_loop_saved
asyncio.get_event_loop = self.get_event_loop_saved
- if sys.platform != 'win32':
+ asyncio.Task = asyncio.tasks.Task = self._Task_saved
+ asyncio.Future = asyncio.futures.Future = self._Future_saved
+ if sys.platform != 'win32':
def test_get_event_loop_new_process(self):
# bpo-32126: The multiprocessing module used by
# ProcessPoolExecutor is not functional when the
@@ -3088,6 +3097,8 @@ class TestPyGetEventLoop(GetEventLoopTestsMixin,
unittest.TestCase):
get_running_loop_impl = events._py_get_running_loop
get_event_loop_impl = events._py_get_event_loop
+ Task = asyncio.tasks._PyTask
+ Future = asyncio.futures._PyFuture
try:
import _asyncio # NoQA
@@ -3102,6 +3113,8 @@ class TestCGetEventLoop(GetEventLoopTestsMixin,
unittest.TestCase):
get_running_loop_impl = events._c_get_running_loop
get_event_loop_impl = events._c_get_event_loop
+ Task = asyncio.tasks._CTask
+ Future = asyncio.futures._CFuture
class TestServer(unittest.TestCase):
_______________________________________________
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]