Use cross-platform 'ps' for test_multiprocessing
This fixes _get_children() on OS X. bug 1205367 Change-Id: I296ea18dbd601f18fe7367b42bf5aecd9ccf9646
This commit is contained in:
parent
e9c9cf1ae3
commit
fcaf7d4e62
|
@ -18,6 +18,7 @@
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import httplib2
|
import httplib2
|
||||||
|
import psutil
|
||||||
|
|
||||||
from glance.tests import functional
|
from glance.tests import functional
|
||||||
from glance.tests.utils import execute
|
from glance.tests.utils import execute
|
||||||
|
@ -44,11 +45,11 @@ 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
|
||||||
cmd = ("ps --no-headers --ppid %s -o pid,cmd | "
|
process = psutil.Process(api_pid)
|
||||||
"grep python | " # NOTE(markwash): ignore non-python procs
|
|
||||||
"awk '{print $1; print >> \"/dev/stderr\"}'" % api_pid)
|
children = process.get_children()
|
||||||
_, out, err = execute(cmd, raise_error=True)
|
pids = [str(child.pid) for child in children]
|
||||||
return out.strip().split('\n')
|
return pids
|
||||||
|
|
||||||
def test_interrupt_avoids_respawn_storm(self):
|
def test_interrupt_avoids_respawn_storm(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -18,6 +18,7 @@ nosehtmloutput>=0.0.3
|
||||||
sphinx>=1.1.2
|
sphinx>=1.1.2
|
||||||
requests
|
requests
|
||||||
testtools>=0.9.22
|
testtools>=0.9.22
|
||||||
|
psutil<1.0
|
||||||
|
|
||||||
# Optional packages that should be installed when testing
|
# Optional packages that should be installed when testing
|
||||||
MySQL-python
|
MySQL-python
|
||||||
|
|
Loading…
Reference in New Issue