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):
233233        self .assertIsNone (self .loop ._default_executor )
234234
235235    def  test_shutdown_default_executor_timeout (self ):
236+         event  =  threading .Event ()
237+ 
236238        class  DummyExecutor (concurrent .futures .ThreadPoolExecutor ):
237239            def  shutdown (self , wait = True , * , cancel_futures = False ):
238240                if  wait :
239-                     time . sleep ( 0.1 )
241+                     event . wait ( )
240242
241243        self .loop ._process_events  =  mock .Mock ()
242244        self .loop ._write_to_self  =  mock .Mock ()
243245        executor  =  DummyExecutor ()
244246        self .loop .set_default_executor (executor )
245247
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 ()
250255
251256    def  test_call_soon (self ):
252257        def  cb ():
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments