summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2020-02-09 22:11:51 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2020-02-09 22:11:51 +0100
commit17b702945351f91bb3dc61010eddf26b68fd596b (patch)
tree5b1f33e89d537b91251fc844275167839589f3d8
parent05758f6978aefea709150898ae285b3ff3688c7c (diff)
downloadpsutil-17b702945351f91bb3dc61010eddf26b68fd596b.tar.gz
Fix test errors for PYPY.
It looks like PYPY implementation has some issues with strings (or maybe it's a subprocess bug?). Anyway, this is the full output: PYTHONWARNINGS=all PSUTIL_TESTING=1 PSUTIL_DEBUG=1 pypy3 -c "import psutil.tests.runner as r; r.run(last_failed=True)" psutil.tests.test_unicode.TestFSAPIsWithInvalidPath.test_proc_cmdline ... /home/giampaolo/svn/psutil/@psutil-test-30050f��: error while loading shared libraries: libpypy3-c.so: cannot open shared object file: No such file or directory FAIL psutil.tests.test_unicode.TestFSAPIsWithInvalidPath.test_proc_exe ... /home/giampaolo/svn/psutil/@psutil-test-30050f��: error while loading shared libraries: libpypy3-c.so: cannot open shared object file: No such file or directory FAIL psutil.tests.test_unicode.TestFSAPIsWithInvalidPath.test_proc_name ... /home/giampaolo/svn/psutil/@psutil-test-30050f��: error while loading shared libraries: libpypy3-c.so: cannot open shared object file: No such file or directory FAIL psutil.tests.test_process.TestProcess.test_long_cmdline ... /home/giampaolo/svn/psutil/@psutil-test-30050: error while loading shared libraries: libpypy3-c.so: cannot open shared object file: No such file or directory FAIL psutil.tests.test_process.TestProcess.test_long_name ... /home/giampaolo/svn/psutil/@psutil-test-3005001234567890123456789: error while loading shared libraries: libpypy3-c.so: cannot open shared object file: No such file or directory FAIL psutil.tests.test_process.TestProcess.test_prog_w_funky_name ... /home/giampaolo/svn/psutil/@psutil-test-30050foo bar ): error while loading shared libraries: libpypy3-c.so: cannot open shared object file: No such file or directory FAIL ====================================================================== FAIL: psutil.tests.test_unicode.TestFSAPIsWithInvalidPath.test_proc_cmdline ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/giampaolo/svn/psutil/psutil/tests/test_unicode.py", line 184, in test_proc_cmdline self.assertEqual(cmdline, [self.funky_name]) AssertionError: Lists differ: [] != ['/home/giampaolo/svn/psutil/@psutil-test-30050f\udcc0\udc80'] Second list contains 1 additional elements. First extra element 0: '/home/giampaolo/svn/psutil/@psutil-test-30050f\udcc0\udc80' - [] + ['/home/giampaolo/svn/psutil/@psutil-test-30050f\udcc0\udc80'] ====================================================================== FAIL: psutil.tests.test_unicode.TestFSAPIsWithInvalidPath.test_proc_exe ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/giampaolo/svn/psutil/psutil/tests/test_unicode.py", line 168, in test_proc_exe os.path.normcase(self.funky_name)) AssertionError: '' != '/home/giampaolo/svn/psutil/@psutil-test-30050f\udcc0\udc80' + /home/giampaolo/svn/psutil/@psutil-test-30050f\udcc0\udc80 ====================================================================== FAIL: psutil.tests.test_unicode.TestFSAPIsWithInvalidPath.test_proc_name ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/giampaolo/svn/psutil/psutil/tests/test_unicode.py", line 175, in test_proc_name self.assertEqual(name, os.path.basename(self.funky_name)) AssertionError: '@psutil-test-30' != '@psutil-test-30050f\udcc0\udc80' - @psutil-test-30 + @psutil-test-30050f\udcc0\udc80 ? ++++++ ====================================================================== FAIL: psutil.tests.test_process.TestProcess.test_long_cmdline ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/giampaolo/svn/psutil/psutil/tests/test_process.py", line 736, in test_long_cmdline self.assertEqual(p.cmdline(), cmdline) AssertionError: Lists differ: [] != ['/home/giampaolo/svn/psutil/@psutil-test-[282 chars]789'] Second list contains 21 additional elements. First extra element 0: '/home/giampaolo/svn/psutil/@psutil-test-30050' - [] + ['/home/giampaolo/svn/psutil/@psutil-test-30050', + '0123456789', + '0123456789', + '0123456789', + '0123456789', + '0123456789', + '0123456789', + '0123456789', + '0123456789', + '0123456789', + '0123456789', + '0123456789', + '0123456789', + '0123456789', + '0123456789', + '0123456789', + '0123456789', + '0123456789', + '0123456789', + '0123456789', + '0123456789'] ====================================================================== FAIL: psutil.tests.test_process.TestProcess.test_long_name ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/giampaolo/svn/psutil/psutil/tests/test_process.py", line 750, in test_long_name self.assertEqual(p.name(), os.path.basename(long_name)) AssertionError: '@psutil-test-30' != '@psutil-test-3005001234567890123456789' - @psutil-test-30 + @psutil-test-3005001234567890123456789 ====================================================================== FAIL: psutil.tests.test_process.TestProcess.test_prog_w_funky_name ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/giampaolo/svn/psutil/psutil/tests/test_process.py", line 780, in test_prog_w_funky_name self.assertEqual(p.cmdline(), cmdline) AssertionError: Lists differ: [] != ['/home/giampaolo/svn/psutil/@psutil-test-[102 chars], ''] Second list contains 7 additional elements. First extra element 0: '/home/giampaolo/svn/psutil/@psutil-test-30050foo bar )' - [] + ['/home/giampaolo/svn/psutil/@psutil-test-30050foo bar )', + '-c', + 'import time; [time.sleep(0.01) for x in range(3000)];arg1', + 'arg2', + '', + 'arg3', + ''] ----------------------------------------------------------------------
-rw-r--r--psutil/_psutil_common.h8
-rwxr-xr-xpsutil/tests/test_process.py3
-rw-r--r--psutil/tests/test_unicode.py1
3 files changed, 8 insertions, 4 deletions
diff --git a/psutil/_psutil_common.h b/psutil/_psutil_common.h
index e91bf2dd..2fccab81 100644
--- a/psutil/_psutil_common.h
+++ b/psutil/_psutil_common.h
@@ -29,11 +29,11 @@ static const int PSUTIL_CONN_NONE = 128;
// --- _Py_PARSE_PID
-// SIZEOF_INT|LONG is missing on Linux + PyPy (only?)
-// SIZEOF_PID_T is missing on Windows + Python2
-// In we can't determine we assume PID is an (int).
+// SIZEOF_INT|LONG is missing on Linux + PyPy (only?).
+// SIZEOF_PID_T is missing on Windows + Python2.
+// In we can't determine pid_t size we assume it's an (int).
// On major UNIX platforms I've seen pid_t is treated as int.
-// On Windows _getpid() returns an int. We can't be 100% certain though,
+// _getpid() on Windows returns an int. We can't be 100% sure though,
// (in that case we'd probably get compiler warnings).
#if !defined(SIZEOF_INT)
#define SIZEOF_INT 4
diff --git a/psutil/tests/test_process.py b/psutil/tests/test_process.py
index 5728f183..0277a56a 100755
--- a/psutil/tests/test_process.py
+++ b/psutil/tests/test_process.py
@@ -727,6 +727,7 @@ class TestProcess(unittest.TestCase):
else:
raise
+ @unittest.skipIf(PYPY, "broken on PYPY")
def test_long_cmdline(self):
create_exe(TESTFN)
self.addCleanup(safe_rmpath, TESTFN)
@@ -741,6 +742,7 @@ class TestProcess(unittest.TestCase):
pyexe = os.path.basename(os.path.realpath(sys.executable)).lower()
assert pyexe.startswith(name), (pyexe, name)
+ @unittest.skipIf(PYPY, "unreliable on PYPY")
def test_long_name(self):
long_name = TESTFN + ("0123456789" * 2)
create_exe(long_name)
@@ -752,6 +754,7 @@ class TestProcess(unittest.TestCase):
# XXX
@unittest.skipIf(SUNOS, "broken on SUNOS")
@unittest.skipIf(AIX, "broken on AIX")
+ @unittest.skipIf(PYPY, "broken on PYPY")
def test_prog_w_funky_name(self):
# Test that name(), exe() and cmdline() correctly handle programs
# with funky chars such as spaces and ")", see:
diff --git a/psutil/tests/test_unicode.py b/psutil/tests/test_unicode.py
index 91395ebf..eecd7dc4 100644
--- a/psutil/tests/test_unicode.py
+++ b/psutil/tests/test_unicode.py
@@ -298,6 +298,7 @@ class TestFSAPIs(_BaseFSAPIsTests, unittest.TestCase):
@unittest.skipIf(PYPY and TRAVIS, "unreliable on PYPY + TRAVIS")
@unittest.skipIf(MACOS and TRAVIS, "unreliable on TRAVIS") # TODO
+@unittest.skipIf(PYPY, "unreliable on PYPY")
@unittest.skipIf(not subprocess_supports_unicode(INVALID_NAME),
"subprocess can't deal with invalid unicode")
class TestFSAPIsWithInvalidPath(_BaseFSAPIsTests, unittest.TestCase):