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

View File

@ -47,8 +47,12 @@ class TestMultiprocessing(functional.FunctionalTest):
def _get_children(self):
api_pid = self.api_server.process_pid
process = psutil.Process(api_pid)
children = process.get_children()
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