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 @@ -232,20 +232,25 @@ def test_set_default_executor_error(self):
232232 self .assertIsNone (self .loop ._default_executor )
233233
234234 def test_shutdown_default_executor_timeout (self ):
235+ event = threading .Event ()
236+
235237 class DummyExecutor (concurrent .futures .ThreadPoolExecutor ):
236238 def shutdown (self , wait = True , * , cancel_futures = False ):
237239 if wait :
238- time . sleep ( 0.1 )
240+ event . wait ( )
239241
240242 self .loop ._process_events = mock .Mock ()
241243 self .loop ._write_to_self = mock .Mock ()
242244 executor = DummyExecutor ()
243245 self .loop .set_default_executor (executor )
244246
245- with self .assertWarnsRegex (RuntimeWarning ,
246- "The executor did not finishing joining" ):
247- self .loop .run_until_complete (
248- self .loop .shutdown_default_executor (timeout = 0.01 ))
247+ try :
248+ with self .assertWarnsRegex (RuntimeWarning ,
249+ "The executor did not finishing joining" ):
250+ self .loop .run_until_complete (
251+ self .loop .shutdown_default_executor (timeout = 0.01 ))
252+ finally :
253+ event .set ()
249254
250255 def test_call_soon (self ):
251256 def cb ():
You can’t perform that action at this time.
0 commit comments