@@ -2930,11 +2930,16 @@ class GetEventLoopTestsMixin:
29302930 get_running_loop_impl = None
29312931 get_event_loop_impl = None
29322932
2933+ Task = None
2934+ Future = None
2935+
29332936 def setUp (self ):
29342937 self ._get_running_loop_saved = events ._get_running_loop
29352938 self ._set_running_loop_saved = events ._set_running_loop
29362939 self .get_running_loop_saved = events .get_running_loop
29372940 self .get_event_loop_saved = events .get_event_loop
2941+ self ._Task_saved = asyncio .Task
2942+ self ._Future_saved = asyncio .Future
29382943
29392944 events ._get_running_loop = type (self )._get_running_loop_impl
29402945 events ._set_running_loop = type (self )._set_running_loop_impl
@@ -2946,6 +2951,8 @@ def setUp(self):
29462951 asyncio .get_running_loop = type (self ).get_running_loop_impl
29472952 asyncio .get_event_loop = type (self ).get_event_loop_impl
29482953
2954+ asyncio .Task = asyncio .tasks .Task = type (self ).Task
2955+ asyncio .Future = asyncio .futures .Future = type (self ).Future
29492956 super ().setUp ()
29502957
29512958 self .loop = asyncio .new_event_loop ()
@@ -2968,8 +2975,10 @@ def tearDown(self):
29682975 asyncio .get_running_loop = self .get_running_loop_saved
29692976 asyncio .get_event_loop = self .get_event_loop_saved
29702977
2971- if sys .platform != 'win32' :
2978+ asyncio .Task = asyncio .tasks .Task = self ._Task_saved
2979+ asyncio .Future = asyncio .futures .Future = self ._Future_saved
29722980
2981+ if sys .platform != 'win32' :
29732982 def test_get_event_loop_new_process (self ):
29742983 # bpo-32126: The multiprocessing module used by
29752984 # ProcessPoolExecutor is not functional when the
@@ -3088,6 +3097,8 @@ class TestPyGetEventLoop(GetEventLoopTestsMixin, unittest.TestCase):
30883097 get_running_loop_impl = events ._py_get_running_loop
30893098 get_event_loop_impl = events ._py_get_event_loop
30903099
3100+ Task = asyncio .tasks ._PyTask
3101+ Future = asyncio .futures ._PyFuture
30913102
30923103try :
30933104 import _asyncio # NoQA
@@ -3102,6 +3113,8 @@ class TestCGetEventLoop(GetEventLoopTestsMixin, unittest.TestCase):
31023113 get_running_loop_impl = events ._c_get_running_loop
31033114 get_event_loop_impl = events ._c_get_event_loop
31043115
3116+ Task = asyncio .tasks ._CTask
3117+ Future = asyncio .futures ._CFuture
31053118
31063119class TestServer (unittest .TestCase ):
31073120
0 commit comments