From d16c046f0e08652456238127b1dc807f090c158f Mon Sep 17 00:00:00 2001 From: Lucas Meneghel Rodrigues Date: Wed, 16 Sep 2015 18:49:50 -0300 Subject: [PATCH] selftests/test_interrupt.py: Make test compatible with psutils 0.6 Fedora 21 ships psutils 0.6, that has the API psutil.get_pid_list() instead of psutil.pids(). Let's make both compatible, for the sake of running unittests on COPR builds. Signed-off-by: Lucas Meneghel Rodrigues --- selftests/functional/test_interrupt.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/selftests/functional/test_interrupt.py b/selftests/functional/test_interrupt.py index eecd94d9..4ceccc11 100644 --- a/selftests/functional/test_interrupt.py +++ b/selftests/functional/test_interrupt.py @@ -13,7 +13,6 @@ else: import unittest from avocado.utils import wait -from avocado.utils import process from avocado.utils import script from avocado.utils import data_factory @@ -85,7 +84,13 @@ class InterruptTest(unittest.TestCase): # Make sure the bad test will be really gone from the process table def wait_until_no_badtest(): bad_test_processes = [] - for p in psutil.pids(): + + try: + process_list = psutil.pids() + except AttributeError: + process_list = psutil.get_pid_list() + + for p in process_list: p_obj = None try: p_obj = psutil.Process(p) @@ -126,7 +131,13 @@ class InterruptTest(unittest.TestCase): # Make sure the good test will be really gone from the process table def wait_until_no_goodtest(): good_test_processes = [] - for p in psutil.pids(): + + try: + process_list = psutil.pids() + except AttributeError: + process_list = psutil.get_pid_list() + + for p in process_list: p_obj = None try: p_obj = psutil.Process(p) -- GitLab