Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/psutil/files/
Date: Tue, 10 May 2022 14:04:28
Message-Id: 1652191459.228026a1911d31890da51a358218bbe7f735db60.mgorny@gentoo
1 commit: 228026a1911d31890da51a358218bbe7f735db60
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Tue May 10 14:04:02 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue May 10 14:04:19 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=228026a1
7
8 dev-python/psutil: Skip more tests (esp. on SPARC)
9
10 Closes: https://bugs.gentoo.org/843572
11 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
12
13 dev-python/psutil/files/psutil-5.9.0-tests.patch | 94 ++++++++++++++++++++----
14 1 file changed, 79 insertions(+), 15 deletions(-)
15
16 diff --git a/dev-python/psutil/files/psutil-5.9.0-tests.patch b/dev-python/psutil/files/psutil-5.9.0-tests.patch
17 index 245041f81221..6dcf6f240e41 100644
18 --- a/dev-python/psutil/files/psutil-5.9.0-tests.patch
19 +++ b/dev-python/psutil/files/psutil-5.9.0-tests.patch
20 @@ -19,10 +19,18 @@ index 21bb3e61..6c45c9e0 100644
21 IS_64BIT = sys.maxsize > 2 ** 32
22
23 diff --git a/psutil/tests/test_linux.py b/psutil/tests/test_linux.py
24 -index 20e28d29..ab676110 100755
25 +index 20e28d29..c21d0aec 100755
26 --- a/psutil/tests/test_linux.py
27 +++ b/psutil/tests/test_linux.py
28 -@@ -28,6 +28,7 @@ from psutil._compat import PY3
29 +@@ -14,6 +14,7 @@ import errno
30 + import glob
31 + import io
32 + import os
33 ++import platform
34 + import re
35 + import shutil
36 + import socket
37 +@@ -28,6 +29,7 @@ from psutil._compat import PY3
38 from psutil._compat import FileNotFoundError
39 from psutil._compat import basestring
40 from psutil._compat import u
41 @@ -30,7 +38,39 @@ index 20e28d29..ab676110 100755
42 from psutil.tests import GITHUB_ACTIONS
43 from psutil.tests import GLOBAL_TIMEOUT
44 from psutil.tests import HAS_BATTERY
45 -@@ -896,11 +897,13 @@ class TestSystemCPUFrequency(PsutilTestCase):
46 +@@ -688,6 +690,7 @@ class TestSystemCPUCountLogical(PsutilTestCase):
47 + num = len([x for x in out.split('\n') if not x.startswith('#')])
48 + self.assertEqual(psutil.cpu_count(logical=True), num)
49 +
50 ++ @unittest.skipIf(GENTOO_TESTING and platform.machine().startswith("sparc"), "broken on Gentoo/SPARC")
51 + def test_emulate_fallbacks(self):
52 + import psutil._pslinux
53 + original = psutil._pslinux.cpu_count_logical()
54 +@@ -735,6 +738,7 @@ class TestSystemCPUCountCores(PsutilTestCase):
55 + core_ids.add(fields[1])
56 + self.assertEqual(psutil.cpu_count(logical=False), len(core_ids))
57 +
58 ++ @unittest.skipIf(GENTOO_TESTING and platform.machine().startswith("sparc"), "broken on Gentoo/SPARC")
59 + def test_method_2(self):
60 + meth_1 = psutil._pslinux.cpu_count_cores()
61 + with mock.patch('glob.glob', return_value=[]) as m:
62 +@@ -755,6 +759,7 @@ class TestSystemCPUCountCores(PsutilTestCase):
63 + class TestSystemCPUFrequency(PsutilTestCase):
64 +
65 + @unittest.skipIf(not HAS_CPU_FREQ, "not supported")
66 ++ @unittest.skipIf(GENTOO_TESTING and platform.machine().startswith("sparc"), "broken on Gentoo/SPARC")
67 + def test_emulate_use_second_file(self):
68 + # https://github.com/giampaolo/psutil/issues/981
69 + def path_exists_mock(path):
70 +@@ -769,6 +774,7 @@ class TestSystemCPUFrequency(PsutilTestCase):
71 + assert psutil.cpu_freq()
72 +
73 + @unittest.skipIf(not HAS_CPU_FREQ, "not supported")
74 ++ @unittest.skipIf(GENTOO_TESTING and platform.machine().startswith("sparc"), "broken on Gentoo/SPARC")
75 + def test_emulate_use_cpuinfo(self):
76 + # Emulate a case where /sys/devices/system/cpu/cpufreq* does not
77 + # exist and /proc/cpuinfo is used instead.
78 +@@ -896,11 +902,13 @@ class TestSystemCPUFrequency(PsutilTestCase):
79 @unittest.skipIf(not LINUX, "LINUX only")
80 class TestSystemCPUStats(PsutilTestCase):
81
82 @@ -44,7 +84,7 @@ index 20e28d29..ab676110 100755
83 def test_interrupts(self):
84 vmstat_value = vmstat("interrupts")
85 psutil_value = psutil.cpu_stats().interrupts
86 -@@ -929,6 +932,7 @@ class TestLoadAvg(PsutilTestCase):
87 +@@ -929,6 +937,7 @@ class TestLoadAvg(PsutilTestCase):
88 @unittest.skipIf(not LINUX, "LINUX only")
89 class TestSystemNetIfAddrs(PsutilTestCase):
90
91 @@ -52,7 +92,7 @@ index 20e28d29..ab676110 100755
92 def test_ips(self):
93 for name, addrs in psutil.net_if_addrs().items():
94 for addr in addrs:
95 -@@ -1316,6 +1320,7 @@ class TestRootFsDeviceFinder(PsutilTestCase):
96 +@@ -1316,6 +1325,7 @@ class TestRootFsDeviceFinder(PsutilTestCase):
97 findmnt_value = sh("findmnt -o SOURCE -rn /")
98 self.assertEqual(psutil_value, findmnt_value)
99
100 @@ -60,7 +100,7 @@ index 20e28d29..ab676110 100755
101 def test_disk_partitions_mocked(self):
102 with mock.patch(
103 'psutil._pslinux.cext.disk_partitions',
104 -@@ -1491,6 +1496,7 @@ class TestMisc(PsutilTestCase):
105 +@@ -1491,6 +1501,7 @@ class TestMisc(PsutilTestCase):
106 psutil.PROCFS_PATH = "/proc"
107
108 @retry_on_failure()
109 @@ -68,7 +108,7 @@ index 20e28d29..ab676110 100755
110 def test_issue_687(self):
111 # In case of thread ID:
112 # - pid_exists() is supposed to return False
113 -@@ -1596,6 +1602,8 @@ class TestSensorsBattery(PsutilTestCase):
114 +@@ -1596,6 +1607,8 @@ class TestSensorsBattery(PsutilTestCase):
115 self.assertEqual(psutil.sensors_battery().power_plugged, False)
116 assert m.called
117
118 @@ -77,7 +117,7 @@ index 20e28d29..ab676110 100755
119 def test_emulate_power_undetermined(self):
120 # Pretend we can't know whether the AC power cable not
121 # connected (assert fallback to False).
122 -@@ -1614,6 +1622,8 @@ class TestSensorsBattery(PsutilTestCase):
123 +@@ -1614,6 +1627,8 @@ class TestSensorsBattery(PsutilTestCase):
124 self.assertIsNone(psutil.sensors_battery().power_plugged)
125 assert m.called
126
127 @@ -86,7 +126,7 @@ index 20e28d29..ab676110 100755
128 def test_emulate_energy_full_0(self):
129 # Emulate a case where energy_full files returns 0.
130 with mock_open_content(
131 -@@ -1621,6 +1631,8 @@ class TestSensorsBattery(PsutilTestCase):
132 +@@ -1621,6 +1636,8 @@ class TestSensorsBattery(PsutilTestCase):
133 self.assertEqual(psutil.sensors_battery().percent, 0)
134 assert m.called
135
136 @@ -95,7 +135,7 @@ index 20e28d29..ab676110 100755
137 def test_emulate_energy_full_not_avail(self):
138 # Emulate a case where energy_full file does not exist.
139 # Expected fallback on /capacity.
140 -@@ -1634,6 +1646,8 @@ class TestSensorsBattery(PsutilTestCase):
141 +@@ -1634,6 +1651,8 @@ class TestSensorsBattery(PsutilTestCase):
142 "/sys/class/power_supply/BAT0/capacity", b"88"):
143 self.assertEqual(psutil.sensors_battery().percent, 88)
144
145 @@ -104,7 +144,7 @@ index 20e28d29..ab676110 100755
146 def test_emulate_no_power(self):
147 # Emulate a case where /AC0/online file nor /BAT0/status exist.
148 with mock_open_exception(
149 -@@ -2220,6 +2234,7 @@ class TestProcessAgainstStatus(PsutilTestCase):
150 +@@ -2220,6 +2239,7 @@ class TestProcessAgainstStatus(PsutilTestCase):
151 value = self.read_status_file("nonvoluntary_ctxt_switches:")
152 self.assertEqual(self.proc.num_ctx_switches().involuntary, value)
153
154 @@ -205,10 +245,18 @@ index c9059e33..0050c42a 100755
155 @unittest.skipIf(not POSIX, "POSIX only")
156 def test_weird_environ(self):
157 diff --git a/psutil/tests/test_system.py b/psutil/tests/test_system.py
158 -index db2cb348..411835d4 100755
159 +index db2cb348..d719c59e 100755
160 --- a/psutil/tests/test_system.py
161 +++ b/psutil/tests/test_system.py
162 -@@ -33,6 +33,7 @@ from psutil._compat import long
163 +@@ -10,6 +10,7 @@ import contextlib
164 + import datetime
165 + import errno
166 + import os
167 ++import platform
168 + import pprint
169 + import shutil
170 + import signal
171 +@@ -33,6 +34,7 @@ from psutil._compat import long
172 from psutil.tests import ASCII_FS
173 from psutil.tests import CI_TESTING
174 from psutil.tests import DEVNULL
175 @@ -216,7 +264,7 @@ index db2cb348..411835d4 100755
176 from psutil.tests import GITHUB_ACTIONS
177 from psutil.tests import GLOBAL_TIMEOUT
178 from psutil.tests import HAS_BATTERY
179 -@@ -199,6 +200,7 @@ class TestMiscAPIs(PsutilTestCase):
180 +@@ -199,6 +201,7 @@ class TestMiscAPIs(PsutilTestCase):
181 self.assertGreater(bt, 0)
182 self.assertLess(bt, time.time())
183
184 @@ -224,7 +272,23 @@ index db2cb348..411835d4 100755
185 @unittest.skipIf(CI_TESTING and not psutil.users(), "unreliable on CI")
186 def test_users(self):
187 users = psutil.users()
188 -@@ -580,6 +582,7 @@ class TestDiskAPIs(PsutilTestCase):
189 +@@ -426,6 +429,7 @@ class TestCpuAPIs(PsutilTestCase):
190 + if difference >= 0.05:
191 + return
192 +
193 ++ @unittest.skipIf(GENTOO_TESTING, "flaky")
194 + def test_cpu_times_comparison(self):
195 + # Make sure the sum of all per cpu times is almost equal to
196 + # base "one cpu" times.
197 +@@ -512,6 +516,7 @@ class TestCpuAPIs(PsutilTestCase):
198 + self.assertGreater(value, 0)
199 +
200 + @unittest.skipIf(not HAS_CPU_FREQ, "not suported")
201 ++ @unittest.skipIf(GENTOO_TESTING and platform.machine().startswith("sparc"), "broken on Gentoo/SPARC")
202 + def test_cpu_freq(self):
203 + def check_ls(ls):
204 + for nt in ls:
205 +@@ -580,6 +585,7 @@ class TestDiskAPIs(PsutilTestCase):
206 def test_disk_usage_bytes(self):
207 psutil.disk_usage(b'.')