summaryrefslogtreecommitdiffstats
path: root/meta-python/recipes-devtools/python/python3-psutil/0001-fix-failure-test-cases.patch
diff options
context:
space:
mode:
authorChangqing Li <changqing.li@windriver.com>2022-02-24 09:16:37 +0800
committerKhem Raj <raj.khem@gmail.com>2022-02-24 08:30:26 -0800
commita0f7710fe28ec686669a9934726bfbb48812d922 (patch)
tree6dbbcd424d1b3cb56ba01f4d2ca65c714ef934df /meta-python/recipes-devtools/python/python3-psutil/0001-fix-failure-test-cases.patch
parentaab5ca2175d470ce9916e5f98d70c7d4a4add7a3 (diff)
downloadmeta-openembedded-a0f7710fe28ec686669a9934726bfbb48812d922.tar.gz
python3-psutil: fix test failure
fix serval failure of "python3 -m psutil.tests" Signed-off-by: Changqing Li <changqing.li@windriver.com> Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Trevor Gamblin <trevor.gamblin@windriver.com>
Diffstat (limited to 'meta-python/recipes-devtools/python/python3-psutil/0001-fix-failure-test-cases.patch')
-rw-r--r--meta-python/recipes-devtools/python/python3-psutil/0001-fix-failure-test-cases.patch197
1 files changed, 197 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-psutil/0001-fix-failure-test-cases.patch b/meta-python/recipes-devtools/python/python3-psutil/0001-fix-failure-test-cases.patch
new file mode 100644
index 000000000..34ea03b27
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-psutil/0001-fix-failure-test-cases.patch
@@ -0,0 +1,197 @@
1From 8b4e38958ff8bdbb3ece4796bfa2d3b6f7536f71 Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Wed, 23 Feb 2022 11:54:40 +0800
4Subject: [PATCH] fix failure test cases
5
6The test cases is not robust enough. skip some cases that is
7not suitable for all conditions.
8
9* test_io_counters failed when kernel config CONFIG_TASKSTATS
10 and CONFIG_TASK_IO_ACCOUNTING are not enable in OE
11* test_setup_script failed since oe don't install setup.py
12* test_used failed since oe use git source for free, so the version
13 is 3.3.17-dirty
14* test_weird_environ failed since gcc not installed
15* test_debug failed since it is designed to run when PSUTIL_DEBUG is set
16* test_against_findmnt/test_comparisons/test_disk_partitions_mocked/
17 test_disk_partitions is not suitable for Linux nfs boot
18
19Upstream-Status: Pending
20
21Signed-off-by: Changqing Li <changqing.li@windriver.com>
22---
23 psutil/tests/test_contracts.py | 1 +
24 psutil/tests/test_linux.py | 8 ++++++--
25 psutil/tests/test_misc.py | 4 ++++
26 psutil/tests/test_process.py | 5 +++++
27 psutil/tests/test_system.py | 1 +
28 psutil/tests/test_unicode.py | 4 +++-
29 6 files changed, 20 insertions(+), 3 deletions(-)
30
31diff --git a/psutil/tests/test_contracts.py b/psutil/tests/test_contracts.py
32index 7401cc1..bf0fca0 100755
33--- a/psutil/tests/test_contracts.py
34+++ b/psutil/tests/test_contracts.py
35@@ -172,6 +172,7 @@ class TestAvailProcessAPIs(PsutilTestCase):
36 def test_rlimit(self):
37 self.assertEqual(hasattr(psutil.Process, "rlimit"), LINUX or FREEBSD)
38
39+ @unittest.skip("broken on OE since kernel config maye not be enabled")
40 def test_io_counters(self):
41 hasit = hasattr(psutil.Process, "io_counters")
42 self.assertEqual(hasit, False if MACOS or SUNOS else True)
43diff --git a/psutil/tests/test_linux.py b/psutil/tests/test_linux.py
44index 20e28d2..66b6dda 100755
45--- a/psutil/tests/test_linux.py
46+++ b/psutil/tests/test_linux.py
47@@ -196,8 +196,9 @@ def get_free_version_info():
48 out = sh(["free", "-V"]).strip()
49 if 'UNKNOWN' in out:
50 raise unittest.SkipTest("can't determine free version")
51- return tuple(map(int, out.split()[-1].split('.')))
52-
53+ vlist = out.split()[-1].split('.')
54+ vlist[:] = [n.split('-')[0] for n in vlist]
55+ return tuple(map(int, vlist))
56
57 @contextlib.contextmanager
58 def mock_open_content(for_path, content):
59@@ -1289,6 +1290,7 @@ class TestRootFsDeviceFinder(PsutilTestCase):
60 finder.ask_sys_class_block()
61
62 @unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS")
63+ @unittest.skip("Broken for oe")
64 def test_comparisons(self):
65 finder = RootFsDeviceFinder()
66 self.assertIsNotNone(finder.find())
67@@ -1311,11 +1313,13 @@ class TestRootFsDeviceFinder(PsutilTestCase):
68
69 @unittest.skipIf(not which("findmnt"), "findmnt utility not available")
70 @unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS")
71+ @unittest.skip("Broken for oe")
72 def test_against_findmnt(self):
73 psutil_value = RootFsDeviceFinder().find()
74 findmnt_value = sh("findmnt -o SOURCE -rn /")
75 self.assertEqual(psutil_value, findmnt_value)
76
77+ @unittest.skip("Broken for oe")
78 def test_disk_partitions_mocked(self):
79 with mock.patch(
80 'psutil._pslinux.cext.disk_partitions',
81diff --git a/psutil/tests/test_misc.py b/psutil/tests/test_misc.py
82index d946eb6..121004a 100755
83--- a/psutil/tests/test_misc.py
84+++ b/psutil/tests/test_misc.py
85@@ -54,6 +54,8 @@ from psutil.tests import unittest
86 # ===================================================================
87
88
89+PSUTIL_DEBUG = bool(os.getenv('PSUTIL_DEBUG', 0))
90+
91 class TestMisc(PsutilTestCase):
92
93 def test_process__repr__(self, func=repr):
94@@ -368,6 +370,7 @@ class TestMisc(PsutilTestCase):
95
96 # XXX: https://github.com/pypa/setuptools/pull/2896
97 @unittest.skipIf(APPVEYOR, "temporarily disabled due to setuptools bug")
98+ @unittest.skip("OE run this test outof source tree")
99 def test_setup_script(self):
100 setup_py = os.path.join(ROOT_DIR, 'setup.py')
101 if CI_TESTING and not os.path.exists(setup_py):
102@@ -401,6 +404,7 @@ class TestMisc(PsutilTestCase):
103 reload_module(psutil)
104 self.assertIn("version conflict", str(cm.exception).lower())
105
106+ @unittest.skipIf(not PSUTIL_DEBUG, "env PSUTIL_DEBUG not set")
107 def test_debug(self):
108 if PY3:
109 from io import StringIO
110diff --git a/psutil/tests/test_process.py b/psutil/tests/test_process.py
111index c9059e3..a34ba3d 100755
112--- a/psutil/tests/test_process.py
113+++ b/psutil/tests/test_process.py
114@@ -36,6 +36,7 @@ from psutil._compat import PY3
115 from psutil._compat import FileNotFoundError
116 from psutil._compat import long
117 from psutil._compat import super
118+from psutil._compat import which
119 from psutil.tests import APPVEYOR
120 from psutil.tests import CI_TESTING
121 from psutil.tests import GITHUB_ACTIONS
122@@ -726,6 +727,7 @@ class TestProcess(PsutilTestCase):
123 self.assertEqual(' '.join(p.cmdline()), ' '.join(cmdline))
124
125 @unittest.skipIf(PYPY, "broken on PYPY")
126+ @unittest.skipIf(not which("gcc"), "gcc not installed")
127 def test_long_cmdline(self):
128 testfn = self.get_testfn()
129 create_exe(testfn)
130@@ -740,6 +742,7 @@ class TestProcess(PsutilTestCase):
131 assert pyexe.startswith(name), (pyexe, name)
132
133 @unittest.skipIf(PYPY, "unreliable on PYPY")
134+ @unittest.skipIf(not which("gcc"), "gcc not installed")
135 def test_long_name(self):
136 testfn = self.get_testfn(suffix="0123456789" * 2)
137 create_exe(testfn)
138@@ -750,6 +753,7 @@ class TestProcess(PsutilTestCase):
139 @unittest.skipIf(SUNOS, "broken on SUNOS")
140 @unittest.skipIf(AIX, "broken on AIX")
141 @unittest.skipIf(PYPY, "broken on PYPY")
142+ @unittest.skipIf(not which("gcc"), "gcc not installed")
143 def test_prog_w_funky_name(self):
144 # Test that name(), exe() and cmdline() correctly handle programs
145 # with funky chars such as spaces and ")", see:
146@@ -1408,6 +1412,7 @@ class TestProcess(PsutilTestCase):
147
148 @unittest.skipIf(not HAS_ENVIRON, "not supported")
149 @unittest.skipIf(not POSIX, "POSIX only")
150+ @unittest.skipIf(not which("gcc"), "gcc not installed")
151 def test_weird_environ(self):
152 # environment variables can contain values without an equals sign
153 code = textwrap.dedent("""
154diff --git a/psutil/tests/test_system.py b/psutil/tests/test_system.py
155index db2cb34..5ee519f 100755
156--- a/psutil/tests/test_system.py
157+++ b/psutil/tests/test_system.py
158@@ -580,6 +580,7 @@ class TestDiskAPIs(PsutilTestCase):
159 def test_disk_usage_bytes(self):
160 psutil.disk_usage(b'.')
161
162+ @unittest.skip("Broken for oe")
163 def test_disk_partitions(self):
164 def check_ntuple(nt):
165 self.assertIsInstance(nt.device, str)
166diff --git a/psutil/tests/test_unicode.py b/psutil/tests/test_unicode.py
167index e635726..7ba5b0f 100755
168--- a/psutil/tests/test_unicode.py
169+++ b/psutil/tests/test_unicode.py
170@@ -86,6 +86,7 @@ from psutil import POSIX
171 from psutil import WINDOWS
172 from psutil._compat import PY3
173 from psutil._compat import u
174+from psutil._compat import which
175 from psutil.tests import APPVEYOR
176 from psutil.tests import ASCII_FS
177 from psutil.tests import CI_TESTING
178@@ -156,7 +157,7 @@ def try_unicode(suffix):
179 # FS APIs
180 # ===================================================================
181
182-
183+@unittest.skipIf(not which("gcc"), "gcc not installed")
184 class BaseUnicodeTest(PsutilTestCase):
185 funky_suffix = None
186
187@@ -169,6 +170,7 @@ class BaseUnicodeTest(PsutilTestCase):
188 @serialrun
189 @unittest.skipIf(ASCII_FS, "ASCII fs")
190 @unittest.skipIf(PYPY and not PY3, "too much trouble on PYPY2")
191+@unittest.skipIf(not which("gcc"), "gcc not installed")
192 class TestFSAPIs(BaseUnicodeTest):
193 """Test FS APIs with a funky, valid, UTF8 path name."""
194
195--
1962.25.1
197