@@ -2930,11 +2930,16 @@ class GetEventLoopTestsMixin:
2930
2930
get_running_loop_impl = None
2931
2931
get_event_loop_impl = None
2932
2932
2933
+ Task = None
2934
+ Future = None
2935
+
2933
2936
def setUp (self ):
2934
2937
self ._get_running_loop_saved = events ._get_running_loop
2935
2938
self ._set_running_loop_saved = events ._set_running_loop
2936
2939
self .get_running_loop_saved = events .get_running_loop
2937
2940
self .get_event_loop_saved = events .get_event_loop
2941
+ self ._Task_saved = asyncio .Task
2942
+ self ._Future_saved = asyncio .Future
2938
2943
2939
2944
events ._get_running_loop = type (self )._get_running_loop_impl
2940
2945
events ._set_running_loop = type (self )._set_running_loop_impl
@@ -2946,6 +2951,8 @@ def setUp(self):
2946
2951
asyncio .get_running_loop = type (self ).get_running_loop_impl
2947
2952
asyncio .get_event_loop = type (self ).get_event_loop_impl
2948
2953
2954
+ asyncio .Task = asyncio .tasks .Task = type (self ).Task
2955
+ asyncio .Future = asyncio .futures .Future = type (self ).Future
2949
2956
super ().setUp ()
2950
2957
2951
2958
self .loop = asyncio .new_event_loop ()
@@ -2968,8 +2975,10 @@ def tearDown(self):
2968
2975
asyncio .get_running_loop = self .get_running_loop_saved
2969
2976
asyncio .get_event_loop = self .get_event_loop_saved
2970
2977
2971
- if sys .platform != 'win32' :
2978
+ asyncio .Task = asyncio .tasks .Task = self ._Task_saved
2979
+ asyncio .Future = asyncio .futures .Future = self ._Future_saved
2972
2980
2981
+ if sys .platform != 'win32' :
2973
2982
def test_get_event_loop_new_process (self ):
2974
2983
# bpo-32126: The multiprocessing module used by
2975
2984
# ProcessPoolExecutor is not functional when the
@@ -3088,6 +3097,8 @@ class TestPyGetEventLoop(GetEventLoopTestsMixin, unittest.TestCase):
3088
3097
get_running_loop_impl = events ._py_get_running_loop
3089
3098
get_event_loop_impl = events ._py_get_event_loop
3090
3099
3100
+ Task = asyncio .tasks ._PyTask
3101
+ Future = asyncio .futures ._PyFuture
3091
3102
3092
3103
try :
3093
3104
import _asyncio # NoQA
@@ -3102,6 +3113,8 @@ class TestCGetEventLoop(GetEventLoopTestsMixin, unittest.TestCase):
3102
3113
get_running_loop_impl = events ._c_get_running_loop
3103
3114
get_event_loop_impl = events ._c_get_event_loop
3104
3115
3116
+ Task = asyncio .tasks ._CTask
3117
+ Future = asyncio .futures ._CFuture
3105
3118
3106
3119
class TestServer (unittest .TestCase ):
3107
3120
0 commit comments