Skip to content

Instantly share code, notes, and snippets.

@wiggin15
Created October 20, 2015 09:31
Show Gist options
  • Save wiggin15/fa7469f5638bb52acc8e to your computer and use it in GitHub Desktop.
Save wiggin15/fa7469f5638bb52acc8e to your computer and use it in GitHub Desktop.
psutil test run on AIX
root@host-vaix03 (AIX 7.1) > psutil git:(master) py.test test/test_psutil.py 15-10-20 12:26
=========================================================================================================================== test session starts ===========================================================================================================================
platform aix7 -- Python 2.7.8, pytest-2.8.2, py-1.4.30, pluggy-0.3.1
rootdir: /root/psutil, inifile:
collected 183 items
test/test_psutil.py ............F................FF.F.FF..F.s..........ss...F...FFs.F...FFsssssF..........FF....................................................................................F..........
================================================================================================================================ FAILURES =================================================================================================================================
____________________________________________________________________________________________________________________ TestSystemAPIs.test_pid_exists_2 _____________________________________________________________________________________________________________________
self = <test_psutil.TestSystemAPIs testMethod=test_pid_exists_2>
def test_pid_exists_2(self):
reap_children()
pids = psutil.pids()
for pid in pids:
try:
assert psutil.pid_exists(pid)
except AssertionError:
# in case the process disappeared in meantime fail only
# if it is no longer in psutil.pids()
time.sleep(.1)
if pid in psutil.pids():
> self.fail(pid)
E AssertionError: 131076
test/test_psutil.py:741: AssertionError
________________________________________________________________________________________________________________ TestSystemAPIs.test_wait_procs_no_timeout ________________________________________________________________________________________________________________
self = <test_psutil.TestSystemAPIs testMethod=test_wait_procs_no_timeout>
def test_wait_procs_no_timeout(self):
sproc1 = get_test_subprocess()
sproc2 = get_test_subprocess()
sproc3 = get_test_subprocess()
procs = [psutil.Process(x.pid) for x in (sproc1, sproc2, sproc3)]
for p in procs:
> p.terminate()
test/test_psutil.py:670:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <psutil.Process(pid=19267670 (terminated)) at 1348700492>, args = (), kwargs = {}
@functools.wraps(fun)
def wrapper(self, *args, **kwargs):
if not self.is_running():
> raise NoSuchProcess(self.pid, self._name)
E NoSuchProcess: psutil.NoSuchProcess process no longer exists (pid=19267670)
../python/lib/python2.7/site-packages/psutil-3.2.2.1-py2.7-aix-7.1.egg/psutil/__init__.py:301: NoSuchProcess
_________________________________________________________________________________________________________________________ TestProcess.test_Popen __________________________________________________________________________________________________________________________
self = <test_psutil.TestProcess testMethod=test_Popen>
def test_Popen(self):
# Popen class test
# XXX this test causes a ResourceWarning on Python 3 because
# psutil.__subproc instance doesn't get propertly freed.
# Not sure what to do though.
cmd = [PYTHON, "-c", "import time; time.sleep(60);"]
proc = psutil.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
try:
proc.name()
proc.stdin
self.assertTrue(hasattr(proc, 'name'))
self.assertTrue(hasattr(proc, 'stdin'))
self.assertTrue(dir(proc))
self.assertRaises(AttributeError, getattr, proc, 'foo')
finally:
> proc.kill()
test/test_psutil.py:2426:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <psutil.Popen(pid=19267672, name='python2.7.bin') at 1348699180>, args = (), kwargs = {}
@functools.wraps(fun)
def wrapper(self, *args, **kwargs):
if not self.is_running():
> raise NoSuchProcess(self.pid, self._name)
E NoSuchProcess: psutil.NoSuchProcess process no longer exists (pid=19267672, name='python2.7')
../python/lib/python2.7/site-packages/psutil-3.2.2.1-py2.7-aix-7.1.egg/psutil/__init__.py:301: NoSuchProcess
________________________________________________________________________________________________________________________ TestProcess.test_children ________________________________________________________________________________________________________________________
self = <test_psutil.TestProcess testMethod=test_children>
def test_children(self):
p = psutil.Process()
> self.assertEqual(p.children(), [])
E AssertionError: Lists differ: [<psutil.Process(pid=19267672,... != []
E
E First list contains 1 additional elements.
E First extra element 0:
E psutil.Process(pid=19267672, name='python2.7.bin')
E
E - [<psutil.Process(pid=19267672, name='python2.7.bin') at 1350507756>]
E + []
test/test_psutil.py:2135: AssertionError
___________________________________________________________________________________________________________________ TestProcess.test_children_recursive ___________________________________________________________________________________________________________________
self = <test_psutil.TestProcess testMethod=test_children_recursive>
def test_children_recursive(self):
# here we create a subprocess which creates another one as in:
# A (parent) -> B (child) -> C (grandchild)
s = "import subprocess, os, sys, time;"
s += "PYTHON = os.path.realpath(sys.executable);"
s += "cmd = [PYTHON, '-c', 'import time; time.sleep(60);'];"
s += "subprocess.Popen(cmd);"
s += "time.sleep(60);"
get_test_subprocess(cmd=[PYTHON, "-c", s])
p = psutil.Process()
> self.assertEqual(len(p.children(recursive=False)), 1)
E AssertionError: 2 != 1
test/test_psutil.py:2155: AssertionError
-------------------------------------------------------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------------------------------------------------------
/root/psutil/test/test_psutil.py:193: UserWarning: couldn't terminate process psutil.Process(pid=19202136, name='python2.7.bin')
warnings.warn(msg, UserWarning)
/root/psutil/test/test_psutil.py:193: UserWarning: couldn't not kill processes [<psutil.Process(pid=19202136, name='python2.7.bin') at 1347446060>]
warnings.warn(msg, UserWarning)
________________________________________________________________________________________________________________________ TestProcess.test_cmdline _________________________________________________________________________________________________________________________
self = <test_psutil.TestProcess testMethod=test_cmdline>
def test_cmdline(self):
cmdline = [PYTHON, "-c", "import time; time.sleep(60)"]
sproc = get_test_subprocess(cmdline, wait=True)
self.assertEqual(' '.join(psutil.Process(sproc.pid).cmdline()),
> ' '.join(cmdline))
E AssertionError: '/root/python/bin/python2.7 -c' != '/root/python/bin/python2.7 -c import time; time.sleep(60)'
test/test_psutil.py:1715: AssertionError
______________________________________________________________________________________________________________________ TestProcess.test_connections _______________________________________________________________________________________________________________________
args = (<test_psutil.TestProcess testMethod=test_connections>,), kwargs = {}
@functools.wraps(fun)
def wrapper(*args, **kwargs):
try:
> return fun(*args, **kwargs)
test/test_psutil.py:473:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test/test_psutil.py:2012: in test_connections
self.assertEqual(len(cons), 1)
E AssertionError: 0 != 1
-------------------------------------------------------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------------------------------------------------------
/root/psutil/test/test_psutil.py:193: UserWarning: couldn't terminate process psutil.Process(pid=19005536, name='python2.7.bin')
warnings.warn(msg, UserWarning)
/root/psutil/test/test_psutil.py:193: UserWarning: couldn't terminate process psutil.Process(pid=18612332, name='python2.7.bin')
warnings.warn(msg, UserWarning)
/root/psutil/test/test_psutil.py:193: UserWarning: couldn't not kill processes [<psutil.Process(pid=19005536, name='python2.7.bin') at 1350688204>, <psutil.Process(pid=19202136, name='python2.7.bin') at 1347446060>, <psutil.Process(pid=18612332, name='python2.7.bin') at 1350688268>]
warnings.warn(msg, UserWarning)
______________________________________________________________________________________________________________________ TestProcess.test_memory_maps _______________________________________________________________________________________________________________________
self = <test_psutil.TestProcess testMethod=test_memory_maps>
def test_memory_maps(self):
p = psutil.Process()
> maps = p.memory_maps()
E AttributeError: 'Process' object has no attribute 'memory_maps'
test/test_psutil.py:1649: AttributeError
____________________________________________________________________________________________________________________ TestProcess.test_num_ctx_switches ____________________________________________________________________________________________________________________
args = (<test_psutil.TestProcess testMethod=test_num_ctx_switches>,), kwargs = {}
@functools.wraps(fun)
def wrapper(*args, **kwargs):
try:
> return fun(*args, **kwargs)
test/test_psutil.py:491:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <test_psutil.TestProcess testMethod=test_num_ctx_switches>
@skip_on_not_implemented(only_if=LINUX)
def test_num_ctx_switches(self):
p = psutil.Process()
> before = sum(p.num_ctx_switches())
E AttributeError: 'Process' object has no attribute 'num_ctx_switches'
test/test_psutil.py:2114: AttributeError
________________________________________________________________________________________________________________________ TestProcess.test_num_fds _________________________________________________________________________________________________________________________
self = <test_psutil.TestProcess testMethod=test_num_fds>
@unittest.skipUnless(POSIX, 'posix only')
def test_num_fds(self):
p = psutil.Process()
start = p.num_fds()
file = open(TESTFN, 'w')
self.addCleanup(file.close)
self.assertEqual(p.num_fds(), start + 1)
sock = socket.socket()
self.addCleanup(sock.close)
> self.assertEqual(p.num_fds(), start + 2)
E AssertionError: 12 != 13
test/test_psutil.py:2106: AssertionError
_______________________________________________________________________________________________________________________ TestProcess.test_open_files _______________________________________________________________________________________________________________________
self = <test_psutil.TestProcess testMethod=test_open_files>
@unittest.skipIf(BSD, "broken on BSD, see #595")
@unittest.skipIf(APPVEYOR,
"can't find any process file on Appveyor")
def test_open_files(self):
# current process
p = psutil.Process()
files = p.open_files()
self.assertFalse(TESTFN in files)
with open(TESTFN, 'w'):
# give the kernel some time to see the new file
call_until(p.open_files, "len(ret) != %i" % len(files))
filenames = [x.path for x in p.open_files()]
self.assertIn(TESTFN, filenames)
for file in filenames:
> assert os.path.isfile(file), file
E AssertionError: /dev/null
E assert <function isfile at 0x5005d4fc>('/dev/null')
E + where <function isfile at 0x5005d4fc> = <module 'posixpath' from '/root/python/lib/python2.7/posixpath.pyc'>.isfile
E + where <module 'posixpath' from '/root/python/lib/python2.7/posixpath.pyc'> = os.path
test/test_psutil.py:1887: AssertionError
_________________________________________________________________________________________________________________________ TestProcess.test_pid_0 __________________________________________________________________________________________________________________________
self = <test_psutil.TestProcess testMethod=test_pid_0>
def test_pid_0(self):
# Process(0) is supposed to work on all platforms except Linux
if 0 not in psutil.pids():
self.assertRaises(psutil.NoSuchProcess, psutil.Process, 0)
return
p = psutil.Process(0)
> self.assertTrue(p.name())
E AssertionError: '' is not true
test/test_psutil.py:2371: AssertionError
___________________________________________________________________________________________________________________ TestProcess.test_prog_w_funky_name ____________________________________________________________________________________________________________________
self = <test_psutil.TestProcess testMethod=test_prog_w_funky_name>
def test_prog_w_funky_name(self):
# Test that name(), exe() and cmdline() correctly handle programs
# with funky chars such as spaces and ")", see:
# https://github.com/giampaolo/psutil/issues/628
funky_path = create_temp_executable_file('foo bar )')
self.addCleanup(safe_remove, funky_path)
sproc = get_test_subprocess(
[funky_path, "arg1", "arg2", "", "arg3", ""])
p = psutil.Process(sproc.pid)
# ...in order to try to prevent occasional failures on travis
wait_for_pid(p.pid)
normcase = os.path.normcase
> self.assertEqual(p.name(), os.path.basename(funky_path))
E AssertionError: 'psuQnpstNfoo bar' != 'psuQnpstNfoo bar )'
test/test_psutil.py:1735: AssertionError
______________________________________________________________________________________________________________________ TestProcess.test_send_signal _______________________________________________________________________________________________________________________
self = <test_psutil.TestProcess testMethod=test_send_signal>
def test_send_signal(self):
sig = signal.SIGKILL if POSIX else signal.SIGTERM
sproc = get_test_subprocess()
p = psutil.Process(sproc.pid)
p.send_signal(sig)
exit_sig = p.wait()
self.assertFalse(psutil.pid_exists(p.pid))
if POSIX:
self.assertEqual(exit_sig, sig)
#
sproc = get_test_subprocess()
p = psutil.Process(sproc.pid)
p.send_signal(sig)
with mock.patch('psutil.os.kill',
side_effect=OSError(errno.ESRCH, "")) as fun:
with self.assertRaises(psutil.NoSuchProcess):
p.send_signal(sig)
> assert fun.called
E AssertionError: assert <MagicMock name='kill' id='1352387532'>.called
test/test_psutil.py:1234: AssertionError
_____________________________________________________________________________________________________________________ TestProcess.test_zombie_process _____________________________________________________________________________________________________________________
self = <test_psutil.TestProcess testMethod=test_zombie_process>
@unittest.skipUnless(POSIX, 'posix only')
def test_zombie_process(self):
def succeed_or_zombie_p_exc(fun, *args, **kwargs):
try:
fun(*args, **kwargs)
except (psutil.ZombieProcess, psutil.AccessDenied):
pass
# Note: in this test we'll be creating two sub processes.
# Both of them are supposed to be freed / killed by
# reap_children() as they are attributable to 'us'
# (os.getpid()) via children(recursive=True).
src = textwrap.dedent("""\
import os, sys, time, socket, contextlib
child_pid = os.fork()
if child_pid > 0:
time.sleep(3000)
else:
# this is the zombie process
s = socket.socket(socket.AF_UNIX)
with contextlib.closing(s):
s.connect('%s')
if sys.version_info < (3, ):
pid = str(os.getpid())
else:
pid = bytes(str(os.getpid()), 'ascii')
s.sendall(pid)
""" % TESTFN)
with contextlib.closing(socket.socket(socket.AF_UNIX)) as sock:
try:
sock.settimeout(GLOBAL_TIMEOUT)
sock.bind(TESTFN)
sock.listen(1)
pyrun(src)
conn, _ = sock.accept()
select.select([conn.fileno()], [], [], GLOBAL_TIMEOUT)
zpid = int(conn.recv(1024))
zproc = psutil.Process(zpid)
call_until(lambda: zproc.status(),
> "ret == psutil.STATUS_ZOMBIE")
test/test_psutil.py:2315:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
fun = <function <lambda> at 0x507ee064>, expr = 'ret == psutil.STATUS_ZOMBIE', timeout = 3
def call_until(fun, expr, timeout=GLOBAL_TIMEOUT):
"""Keep calling function for timeout secs and exit if eval()
expression is True.
"""
stop_at = time.time() + timeout
while time.time() < stop_at:
ret = fun()
if eval(expr):
return ret
time.sleep(0.001)
> raise RuntimeError('timed out (ret=%r)' % ret)
E RuntimeError: timed out (ret='?')
test/test_psutil.py:445: RuntimeError
__________________________________________________________________________________________________________________ TestFetchAllProcesses.test_fetch_all ___________________________________________________________________________________________________________________
self = <test_psutil.TestFetchAllProcesses testMethod=test_fetch_all>
def test_fetch_all(self):
valid_procs = 0
excluded_names = set([
'send_signal', 'suspend', 'resume', 'terminate', 'kill', 'wait',
'as_dict', 'cpu_percent', 'parent', 'children', 'pid'])
if LINUX and not RLIMIT_SUPPORT:
excluded_names.add('rlimit')
attrs = []
for name in dir(psutil.Process):
if name.startswith("_"):
continue
if name in excluded_names:
continue
attrs.append(name)
default = object()
failures = []
for name in attrs:
for p in psutil.process_iter():
ret = default
try:
try:
args = ()
attr = getattr(p, name, None)
if attr is not None and callable(attr):
if name == 'rlimit':
args = (psutil.RLIMIT_NOFILE,)
ret = attr(*args)
else:
ret = attr
valid_procs += 1
except NotImplementedError:
msg = "%r was skipped because not implemented" % (
self.__class__.__name__ + '.test_' + name)
warn(msg)
except (psutil.NoSuchProcess, psutil.AccessDenied) as err:
self.assertEqual(err.pid, p.pid)
if err.name:
# make sure exception's name attr is set
# with the actual process name
self.assertEqual(err.name, p.name())
self.assertTrue(str(err))
self.assertTrue(err.msg)
else:
if ret not in (0, 0.0, [], None, ''):
assert ret, ret
meth = getattr(self, name)
meth(ret)
except Exception as err:
s = '\n' + '=' * 70 + '\n'
s += "FAIL: test_%s (proc=%s" % (name, p)
if ret != default:
s += ", ret=%s)" % repr(ret)
s += ')\n'
s += '-' * 70
s += "\n%s" % traceback.format_exc()
s = "\n".join((" " * 4) + i for i in s.splitlines())
failures.append(s)
break
if failures:
> self.fail(''.join(failures))
E AssertionError:
E ======================================================================
E FAIL: test_create_time (proc=psutil.Process(pid=6881522, name=''), ret=0.0))
E ----------------------------------------------------------------------
E Traceback (most recent call last):
E File "/root/psutil/test/test_psutil.py", line 2494, in test_fetch_all
E meth(ret)
E File "/root/psutil/test/test_psutil.py", line 2538, in create_time
E self.assertTrue(ret > 0)
E File "/root/python/lib/python2.7/unittest/case.py", line 422, in assertTrue
E raise self.failureException(msg)
E AssertionError: False is not true
E ======================================================================
E FAIL: test_cwd (proc=psutil.Process(pid=1, name='init'), ret=''))
E ----------------------------------------------------------------------
E Traceback (most recent call last):
E File "/root/psutil/test/test_psutil.py", line 2494, in test_fetch_all
E meth(ret)
E File "/root/psutil/test/test_psutil.py", line 2631, in cwd
E assert os.path.isabs(ret), ret
E AssertionError:
E assert <function isabs at 0x5005dd4c>('')
E + where <function isabs at 0x5005dd4c> = <module 'posixpath' from '/root/python/lib/python2.7/posixpath.pyc'>.isabs
E + where <module 'posixpath' from '/root/python/lib/python2.7/posixpath.pyc'> = os.path
E ======================================================================
E FAIL: test_io_counters (proc=psutil.Process(pid=131076, name='wait'))
E ----------------------------------------------------------------------
E Traceback (most recent call last):
E File "/root/psutil/test/test_psutil.py", line 2474, in test_fetch_all
E ret = attr(*args)
E File "/root/python/lib/python2.7/site-packages/psutil-3.2.2.1-py2.7-aix-7.1.egg/psutil/__init__.py", line 675, in io_counters
E return self._proc.io_counters()
E File "/root/python/lib/python2.7/site-packages/psutil-3.2.2.1-py2.7-aix-7.1.egg/psutil/_psaix.py", line 248, in wrapper
E return fun(self, *args, **kwargs)
E File "/root/python/lib/python2.7/site-packages/psutil-3.2.2.1-py2.7-aix-7.1.egg/psutil/_psaix.py", line 473, in io_counters
E rc, wc, rb, wb = cext.proc_io_counters(self.pid)
E OSError: [Errno 0] Error
E ======================================================================
E FAIL: test_memory_info_ex (proc=psutil.Process(pid=0, name=''), ret=pmem(rss=393216L, vms=393216L)))
E ----------------------------------------------------------------------
E Traceback (most recent call last):
E File "/root/psutil/test/test_psutil.py", line 2494, in test_fetch_all
E meth(ret)
E File "/root/psutil/test/test_psutil.py", line 2605, in memory_info_ex
E assert ret.vms > value, ret
E AssertionError: pmem(rss=393216L, vms=393216L)
E assert 393216L > 393216L
E + where 393216L = pmem(rss=393216L, vms=393216L).vms
E ======================================================================
E FAIL: test_name (proc=psutil.Process(pid=0, name=''), ret=''))
E ----------------------------------------------------------------------
E Traceback (most recent call last):
E File "/root/psutil/test/test_psutil.py", line 2494, in test_fetch_all
E meth(ret)
E File "/root/psutil/test/test_psutil.py", line 2535, in name
E self.assertTrue(ret)
E File "/root/python/lib/python2.7/unittest/case.py", line 422, in assertTrue
E raise self.failureException(msg)
E AssertionError: '' is not true
E ======================================================================
E FAIL: test_num_threads (proc=psutil.Process(pid=6881522, name=''), ret=0))
E ----------------------------------------------------------------------
E Traceback (most recent call last):
E File "/root/psutil/test/test_psutil.py", line 2494, in test_fetch_all
E meth(ret)
E File "/root/psutil/test/test_psutil.py", line 2581, in num_threads
E self.assertTrue(ret >= 1)
E File "/root/python/lib/python2.7/unittest/case.py", line 422, in assertTrue
E raise self.failureException(msg)
E AssertionError: False is not true
E ======================================================================
E FAIL: test_open_files (proc=psutil.Process(pid=5439680, name='ksh'), ret=[popenfile(path='/dev/null', fd=61), popenfile(path='/pconsole/lwi/bin/lwistart_src.sh', fd=62)]))
E ----------------------------------------------------------------------
E Traceback (most recent call last):
E File "/root/psutil/test/test_psutil.py", line 2494, in test_fetch_all
E meth(ret)
E File "/root/psutil/test/test_psutil.py", line 2619, in open_files
E assert os.path.isfile(f.path), f
E AssertionError: popenfile(path='/dev/null', fd=61)
E assert <function isfile at 0x5005d4fc>('/dev/null')
E + where <function isfile at 0x5005d4fc> = <module 'posixpath' from '/root/python/lib/python2.7/posixpath.pyc'>.isfile
E + where <module 'posixpath' from '/root/python/lib/python2.7/posixpath.pyc'> = os.path
E + and '/dev/null' = popenfile(path='/dev/null', fd=61).path
E ======================================================================
E FAIL: test_status (proc=psutil.Process(pid=0, name=''), ret='?'))
E ----------------------------------------------------------------------
E Traceback (most recent call last):
E File "/root/psutil/test/test_psutil.py", line 2494, in test_fetch_all
E meth(ret)
E File "/root/psutil/test/test_psutil.py", line 2564, in status
E self.assertTrue(ret != '?')
E File "/root/python/lib/python2.7/unittest/case.py", line 422, in assertTrue
E raise self.failureException(msg)
E AssertionError: False is not true
test/test_psutil.py:2508: AssertionError
______________________________________________________________________________________________________________________ TestExampleScripts.test_pmap _______________________________________________________________________________________________________________________
self = <test_psutil.TestExampleScripts testMethod=test_pmap>
def test_pmap(self):
> self.assert_stdout('pmap.py', args=str(os.getpid()))
test/test_psutil.py:3082:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test/test_psutil.py:3019: in assert_stdout
out = sh(sys.executable + ' ' + exe).strip()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cmdline = '/root/python/bin/python /root/psutil/examples/pmap.py 18743452', stdout = 'pid=18743452, name=python2.7.bin\nAddress RSS Mode Mapping\n'
stderr = 'Traceback (most recent call last):\n File "/root/psutil/examples/pmap.py", line 57, in <module>\n main()\n File ...ain\n for m in p.memory_maps(grouped=False):\nAttributeError: \'Process\' object has no attribute \'memory_maps\'\n'
def sh(cmdline, stdout=subprocess.PIPE, stderr=subprocess.PIPE):
"""run cmd in a subprocess and return its output.
raises RuntimeError on error.
"""
p = subprocess.Popen(cmdline, shell=True, stdout=stdout, stderr=stderr)
stdout, stderr = p.communicate()
if p.returncode != 0:
> raise RuntimeError(stderr)
E RuntimeError: Traceback (most recent call last):
E File "/root/psutil/examples/pmap.py", line 57, in <module>
E main()
E File "/root/psutil/examples/pmap.py", line 46, in main
E for m in p.memory_maps(grouped=False):
E AttributeError: 'Process' object has no attribute 'memory_maps'
test/test_psutil.py:203: RuntimeError
=========================================================================================================== 17 failed, 157 passed, 9 skipped in 220.77 seconds ============================================================================================================
root@host-vaix03 (AIX 7.1) > psutil git:(master) 15-10-20 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment