You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately, this does not work properly when an argument contains space. This causes the psutil/tests/test_process.py::TestProcess::test_long_cmdline test to fail:
________________________ TestProcess.test_long_cmdline _________________________
self = <psutil.tests.test_process.TestProcess testMethod=test_long_cmdline>
@unittest.skipIf(PYPY, "broken on PYPY")
def test_long_cmdline(self):
cmdline = [PYTHON_EXE]
cmdline.extend(["-v"] * 50)
cmdline.extend(["-c", "import time; time.sleep(10)"])
p = self.spawn_psproc(cmdline)
if OPENBSD:
# XXX: for some reason the test process may turn into a
# zombie (don't know why).
try:
self.assertEqual(p.cmdline(), cmdline)
except psutil.ZombieProcess:
raise self.skipTest("OPENBSD: process turned into zombie")
else:
> self.assertEqual(p.cmdline(), cmdline)
E AssertionError: Lists differ: ['/us[297 chars]', '-v', '-v', '-v', '-c', 'import', 'time;', 'time.sleep(10)'] != ['/us[297 chars]', '-v', '-v', '-v', '-c', 'import time; time.sleep(10)']
E
E First differing element 52:
E 'import'
E 'import time; time.sleep(10)'
E
E First list contains 2 additional elements.
E First extra element 53:
E 'time;'
E
E ['/usr/bin/python3.9',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-v',
E '-c',
E + 'import time; time.sleep(10)']
E - 'import',
E - 'time;',
E - 'time.sleep(10)']
psutil/tests/test_process.py:763: AssertionError
self = <psutil.tests.test_unicode.TestFSAPIsWithInvalidPath testMethod=test_proc_cmdline>
def test_proc_cmdline(self):
cmd = [self.funky_name, "-c", "import time; time.sleep(10)"]
subp = self.spawn_testproc(cmd)
p = psutil.Process(subp.pid)
cmdline = p.cmdline()
for part in cmdline:
self.assertIsInstance(part, str)
if self.expect_exact_path_match():
> self.assertEqual(cmdline, cmd)
E AssertionError: Lists differ: ['/tm[18 chars]94a8zf\udcc0\udc80', '-c', 'import', 'time;', 'time.sleep(10)'] != ['/tm[18 chars]94a8zf\udcc0\udc80', '-c', 'import time; time.sleep(10)']
E
E First differing element 2:
E 'import'
E 'import time; time.sleep(10)'
E
E First list contains 2 additional elements.
E First extra element 3:
E 'time;'
E
E + ['/tmp/@psutil-1700-7zi94a8zf\udcc0\udc80', '-c', 'import time; time.sleep(10)']
E - ['/tmp/@psutil-1700-7zi94a8zf\udcc0\udc80',
E - '-c',
E - 'import',
E - 'time;',
E - 'time.sleep(10)']
psutil/tests/test_unicode.py:227: AssertionError
Summary
Description
The current
Process.cmdline()
implementation for SUNOS is this (filepsutil/_pssunos.py
):Unfortunately, this does not work properly when an argument contains space. This causes the
psutil/tests/test_process.py::TestProcess::test_long_cmdline
test to fail:Please note that
pargs
works properly:The text was updated successfully, but these errors were encountered: