diff --git a/tests/gold_tests/thread_config/check_threads.py b/tests/gold_tests/thread_config/check_threads.py index 975e95f8791..7ebfb808cfa 100755 --- a/tests/gold_tests/thread_config/check_threads.py +++ b/tests/gold_tests/thread_config/check_threads.py @@ -23,12 +23,11 @@ def count_threads(ts_path, etnet_threads, accept_threads, task_threads, aio_threads): - for pid in psutil.pids(): + for p in psutil.process_iter(['name', 'cwd', 'threads']): # Find the pid corresponding to the ats process we started in autest. # It needs to match the process name and the binary path. # If autest can expose the pid of the process this is not needed anymore. - p = psutil.Process(pid) if p.name() == '[TS_MAIN]' and p.cwd() == ts_path: etnet_check = set()