File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -233,20 +233,25 @@ def test_set_default_executor_error(self):
233
233
self .assertIsNone (self .loop ._default_executor )
234
234
235
235
def test_shutdown_default_executor_timeout (self ):
236
+ event = threading .Event ()
237
+
236
238
class DummyExecutor (concurrent .futures .ThreadPoolExecutor ):
237
239
def shutdown (self , wait = True , * , cancel_futures = False ):
238
240
if wait :
239
- time . sleep ( 0.1 )
241
+ event . wait ( )
240
242
241
243
self .loop ._process_events = mock .Mock ()
242
244
self .loop ._write_to_self = mock .Mock ()
243
245
executor = DummyExecutor ()
244
246
self .loop .set_default_executor (executor )
245
247
246
- with self .assertWarnsRegex (RuntimeWarning ,
247
- "The executor did not finishing joining" ):
248
- self .loop .run_until_complete (
249
- self .loop .shutdown_default_executor (timeout = 0.01 ))
248
+ try :
249
+ with self .assertWarnsRegex (RuntimeWarning ,
250
+ "The executor did not finishing joining" ):
251
+ self .loop .run_until_complete (
252
+ self .loop .shutdown_default_executor (timeout = 0.01 ))
253
+ finally :
254
+ event .set ()
250
255
251
256
def test_call_soon (self ):
252
257
def cb ():
You can’t perform that action at this time.
0 commit comments