Merge "Adjust test suite for new psutil versions"

This commit is contained in:
Jenkins 2017-01-16 10:39:28 +00:00 committed by Gerrit Code Review
commit 8a25f27340
2 changed files with 12 additions and 3 deletions

View File

@ -76,6 +76,11 @@ class TestReload(functional.FunctionalTest):
pid = None
pid = self._get_parent(server)
process = psutil.Process(pid)
try:
# psutils version >= 2
children = process.children()
except AttributeError:
# psutils version < 2
children = process.get_children()
pids = set()
for child in children:

View File

@ -47,7 +47,11 @@ class TestMultiprocessing(functional.FunctionalTest):
def _get_children(self):
api_pid = self.api_server.process_pid
process = psutil.Process(api_pid)
try:
# psutils version >= 2
children = process.children()
except AttributeError:
# psutils version < 2
children = process.get_children()
pids = [str(child.pid) for child in children]
return pids