Merge "Adjust test suite for new psutil versions"
This commit is contained in:
commit
8a25f27340
|
@ -76,7 +76,12 @@ class TestReload(functional.FunctionalTest):
|
||||||
pid = None
|
pid = None
|
||||||
pid = self._get_parent(server)
|
pid = self._get_parent(server)
|
||||||
process = psutil.Process(pid)
|
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()
|
pids = set()
|
||||||
for child in children:
|
for child in children:
|
||||||
pids.add(child.pid)
|
pids.add(child.pid)
|
||||||
|
|
|
@ -47,8 +47,12 @@ class TestMultiprocessing(functional.FunctionalTest):
|
||||||
def _get_children(self):
|
def _get_children(self):
|
||||||
api_pid = self.api_server.process_pid
|
api_pid = self.api_server.process_pid
|
||||||
process = psutil.Process(api_pid)
|
process = psutil.Process(api_pid)
|
||||||
|
try:
|
||||||
children = process.get_children()
|
# psutils version >= 2
|
||||||
|
children = process.children()
|
||||||
|
except AttributeError:
|
||||||
|
# psutils version < 2
|
||||||
|
children = process.get_children()
|
||||||
pids = [str(child.pid) for child in children]
|
pids = [str(child.pid) for child in children]
|
||||||
return pids
|
return pids
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue