Use cross-platform 'ps' for test_multiprocessing

This fixes _get_children() on OS X.

bug 1205367

Change-Id: I296ea18dbd601f18fe7367b42bf5aecd9ccf9646
This commit is contained in:
Brian Elliott 2013-07-19 17:33:42 +00:00
parent e9c9cf1ae3
commit fcaf7d4e62
2 changed files with 7 additions and 5 deletions

View File

@ -18,6 +18,7 @@
import time
import httplib2
import psutil
from glance.tests import functional
from glance.tests.utils import execute
@ -44,11 +45,11 @@ class TestMultiprocessing(functional.FunctionalTest):
def _get_children(self):
api_pid = self.api_server.process_pid
cmd = ("ps --no-headers --ppid %s -o pid,cmd | "
"grep python | " # NOTE(markwash): ignore non-python procs
"awk '{print $1; print >> \"/dev/stderr\"}'" % api_pid)
_, out, err = execute(cmd, raise_error=True)
return out.strip().split('\n')
process = psutil.Process(api_pid)
children = process.get_children()
pids = [str(child.pid) for child in children]
return pids
def test_interrupt_avoids_respawn_storm(self):
"""

View File

@ -18,6 +18,7 @@ nosehtmloutput>=0.0.3
sphinx>=1.1.2
requests
testtools>=0.9.22
psutil<1.0
# Optional packages that should be installed when testing
MySQL-python