@@ -359,10 +359,13 @@ def test_user_agent(self) -> None:
359359
360360class TestParallelUpdater (TestUpdater ):
361361 def test_parallel_updaters (self ) -> None :
362- # Refresh two updaters in parallel many times, using the same local metadata cache.
362+ # Refresh many updaters in parallel many times, using the same local metadata cache.
363363 # This should reveal race conditions.
364364
365- iterations = 1000
365+ # windows on GitHub actions *will* fail with "[Errno 36] Resource deadlock avoided"
366+ # if iterations is in the hundreds
367+ iterations = 50
368+ process_count = 10
366369
367370 # The project root is the parent of the tests directory
368371 project_root = os .path .dirname (utils .TESTS_DIR )
@@ -376,29 +379,27 @@ def test_parallel_updaters(self) -> None:
376379 self .metadata_url ,
377380 ]
378381
379- p1 = subprocess .Popen (
380- command ,
381- stdout = subprocess .PIPE ,
382- stderr = subprocess .PIPE ,
383- cwd = project_root ,
384- )
385- p2 = subprocess .Popen (
386- command ,
387- stdout = subprocess .PIPE ,
388- stderr = subprocess .PIPE ,
389- cwd = project_root ,
390- )
382+ procs = [
383+ subprocess .Popen (
384+ command ,
385+ stdout = subprocess .PIPE ,
386+ stderr = subprocess .PIPE ,
387+ cwd = project_root ,
388+ )
389+ for _ in range (process_count )
390+ ]
391391
392- stdout1 , stderr1 = p1 .communicate ()
393- stdout2 , stderr2 = p2 .communicate ()
392+ errout = ""
393+ for proc in procs :
394+ stdout , stderr = proc .communicate ()
395+ if proc .returncode != 0 :
396+ errout += "Parallel Refresh script failed:"
397+ errout += f"\n process stdout: \n { stdout .decode ()} "
398+ errout += f"\n process stderr: \n { stderr .decode ()} "
394399
395- if p1 . returncode != 0 or p2 . returncode != 0 :
400+ if errout :
396401 self .fail (
397- "Parallel refresh failed"
398- f"\n process 1 stdout: \n { stdout1 .decode ()} "
399- f"\n process 1 stderr: \n { stderr1 .decode ()} "
400- f"\n process 2 stdout: \n { stdout2 .decode ()} "
401- f"\n process 2 stderr: \n { stderr2 .decode ()} "
402+ f"One or more scripts failed parallel refresh test:\n { errout } "
402403 )
403404
404405
0 commit comments