File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -67,23 +67,23 @@ async def coro():
6767            await  asyncio .sleep (0.01 )
6868
6969        lock  =  threading .Lock ()
70-         count  =  0 
70+         tasks  =  set () 
7171
7272        async  def  main ():
73-             nonlocal  count , loop 
73+             nonlocal  tasks , loop 
7474            loop  =  asyncio .get_running_loop ()
7575            started .set ()
7676            for  i  in  range (1000 ):
7777                with  lock :
7878                    asyncio .create_task (coro ())
79-                     count  =  len ( self .all_tasks (loop ) )
79+                     tasks  =  self .all_tasks (loop )
8080
8181        runner  =  threading .Thread (target = lambda : asyncio .run (main ()))
8282
8383        def  check ():
8484            started .wait ()
8585            with  lock :
86-                 self .assertEqual ( count ,  len ( self .all_tasks (loop )) )
86+                 self .assertSetEqual ( tasks   &   self .all_tasks (loop ),  tasks )
8787
8888        threads  =  [threading .Thread (target = check ) for  _  in  range (10 )]
8989        threads .append (runner )
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments