commit:     228026a1911d31890da51a358218bbe7f735db60
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue May 10 14:04:02 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue May 10 14:04:19 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=228026a1

dev-python/psutil: Skip more tests (esp. on SPARC)

Closes: https://bugs.gentoo.org/843572
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/psutil/files/psutil-5.9.0-tests.patch | 94 ++++++++++++++++++++----
 1 file changed, 79 insertions(+), 15 deletions(-)

diff --git a/dev-python/psutil/files/psutil-5.9.0-tests.patch 
b/dev-python/psutil/files/psutil-5.9.0-tests.patch
index 245041f81221..6dcf6f240e41 100644
--- a/dev-python/psutil/files/psutil-5.9.0-tests.patch
+++ b/dev-python/psutil/files/psutil-5.9.0-tests.patch
@@ -19,10 +19,18 @@ index 21bb3e61..6c45c9e0 100644
  IS_64BIT = sys.maxsize > 2 ** 32
  
 diff --git a/psutil/tests/test_linux.py b/psutil/tests/test_linux.py
-index 20e28d29..ab676110 100755
+index 20e28d29..c21d0aec 100755
 --- a/psutil/tests/test_linux.py
 +++ b/psutil/tests/test_linux.py
-@@ -28,6 +28,7 @@ from psutil._compat import PY3
+@@ -14,6 +14,7 @@ import errno
+ import glob
+ import io
+ import os
++import platform
+ import re
+ import shutil
+ import socket
+@@ -28,6 +29,7 @@ from psutil._compat import PY3
  from psutil._compat import FileNotFoundError
  from psutil._compat import basestring
  from psutil._compat import u
@@ -30,7 +38,39 @@ index 20e28d29..ab676110 100755
  from psutil.tests import GITHUB_ACTIONS
  from psutil.tests import GLOBAL_TIMEOUT
  from psutil.tests import HAS_BATTERY
-@@ -896,11 +897,13 @@ class TestSystemCPUFrequency(PsutilTestCase):
+@@ -688,6 +690,7 @@ class TestSystemCPUCountLogical(PsutilTestCase):
+         num = len([x for x in out.split('\n') if not x.startswith('#')])
+         self.assertEqual(psutil.cpu_count(logical=True), num)
+ 
++    @unittest.skipIf(GENTOO_TESTING and 
platform.machine().startswith("sparc"), "broken on Gentoo/SPARC")
+     def test_emulate_fallbacks(self):
+         import psutil._pslinux
+         original = psutil._pslinux.cpu_count_logical()
+@@ -735,6 +738,7 @@ class TestSystemCPUCountCores(PsutilTestCase):
+                 core_ids.add(fields[1])
+         self.assertEqual(psutil.cpu_count(logical=False), len(core_ids))
+ 
++    @unittest.skipIf(GENTOO_TESTING and 
platform.machine().startswith("sparc"), "broken on Gentoo/SPARC")
+     def test_method_2(self):
+         meth_1 = psutil._pslinux.cpu_count_cores()
+         with mock.patch('glob.glob', return_value=[]) as m:
+@@ -755,6 +759,7 @@ class TestSystemCPUCountCores(PsutilTestCase):
+ class TestSystemCPUFrequency(PsutilTestCase):
+ 
+     @unittest.skipIf(not HAS_CPU_FREQ, "not supported")
++    @unittest.skipIf(GENTOO_TESTING and 
platform.machine().startswith("sparc"), "broken on Gentoo/SPARC")
+     def test_emulate_use_second_file(self):
+         # https://github.com/giampaolo/psutil/issues/981
+         def path_exists_mock(path):
+@@ -769,6 +774,7 @@ class TestSystemCPUFrequency(PsutilTestCase):
+             assert psutil.cpu_freq()
+ 
+     @unittest.skipIf(not HAS_CPU_FREQ, "not supported")
++    @unittest.skipIf(GENTOO_TESTING and 
platform.machine().startswith("sparc"), "broken on Gentoo/SPARC")
+     def test_emulate_use_cpuinfo(self):
+         # Emulate a case where /sys/devices/system/cpu/cpufreq* does not
+         # exist and /proc/cpuinfo is used instead.
+@@ -896,11 +902,13 @@ class TestSystemCPUFrequency(PsutilTestCase):
  @unittest.skipIf(not LINUX, "LINUX only")
  class TestSystemCPUStats(PsutilTestCase):
  
@@ -44,7 +84,7 @@ index 20e28d29..ab676110 100755
      def test_interrupts(self):
          vmstat_value = vmstat("interrupts")
          psutil_value = psutil.cpu_stats().interrupts
-@@ -929,6 +932,7 @@ class TestLoadAvg(PsutilTestCase):
+@@ -929,6 +937,7 @@ class TestLoadAvg(PsutilTestCase):
  @unittest.skipIf(not LINUX, "LINUX only")
  class TestSystemNetIfAddrs(PsutilTestCase):
  
@@ -52,7 +92,7 @@ index 20e28d29..ab676110 100755
      def test_ips(self):
          for name, addrs in psutil.net_if_addrs().items():
              for addr in addrs:
-@@ -1316,6 +1320,7 @@ class TestRootFsDeviceFinder(PsutilTestCase):
+@@ -1316,6 +1325,7 @@ class TestRootFsDeviceFinder(PsutilTestCase):
          findmnt_value = sh("findmnt -o SOURCE -rn /")
          self.assertEqual(psutil_value, findmnt_value)
  
@@ -60,7 +100,7 @@ index 20e28d29..ab676110 100755
      def test_disk_partitions_mocked(self):
          with mock.patch(
                  'psutil._pslinux.cext.disk_partitions',
-@@ -1491,6 +1496,7 @@ class TestMisc(PsutilTestCase):
+@@ -1491,6 +1501,7 @@ class TestMisc(PsutilTestCase):
              psutil.PROCFS_PATH = "/proc"
  
      @retry_on_failure()
@@ -68,7 +108,7 @@ index 20e28d29..ab676110 100755
      def test_issue_687(self):
          # In case of thread ID:
          # - pid_exists() is supposed to return False
-@@ -1596,6 +1602,8 @@ class TestSensorsBattery(PsutilTestCase):
+@@ -1596,6 +1607,8 @@ class TestSensorsBattery(PsutilTestCase):
              self.assertEqual(psutil.sensors_battery().power_plugged, False)
              assert m.called
  
@@ -77,7 +117,7 @@ index 20e28d29..ab676110 100755
      def test_emulate_power_undetermined(self):
          # Pretend we can't know whether the AC power cable not
          # connected (assert fallback to False).
-@@ -1614,6 +1622,8 @@ class TestSensorsBattery(PsutilTestCase):
+@@ -1614,6 +1627,8 @@ class TestSensorsBattery(PsutilTestCase):
              self.assertIsNone(psutil.sensors_battery().power_plugged)
              assert m.called
  
@@ -86,7 +126,7 @@ index 20e28d29..ab676110 100755
      def test_emulate_energy_full_0(self):
          # Emulate a case where energy_full files returns 0.
          with mock_open_content(
-@@ -1621,6 +1631,8 @@ class TestSensorsBattery(PsutilTestCase):
+@@ -1621,6 +1636,8 @@ class TestSensorsBattery(PsutilTestCase):
              self.assertEqual(psutil.sensors_battery().percent, 0)
              assert m.called
  
@@ -95,7 +135,7 @@ index 20e28d29..ab676110 100755
      def test_emulate_energy_full_not_avail(self):
          # Emulate a case where energy_full file does not exist.
          # Expected fallback on /capacity.
-@@ -1634,6 +1646,8 @@ class TestSensorsBattery(PsutilTestCase):
+@@ -1634,6 +1651,8 @@ class TestSensorsBattery(PsutilTestCase):
                          "/sys/class/power_supply/BAT0/capacity", b"88"):
                      self.assertEqual(psutil.sensors_battery().percent, 88)
  
@@ -104,7 +144,7 @@ index 20e28d29..ab676110 100755
      def test_emulate_no_power(self):
          # Emulate a case where /AC0/online file nor /BAT0/status exist.
          with mock_open_exception(
-@@ -2220,6 +2234,7 @@ class TestProcessAgainstStatus(PsutilTestCase):
+@@ -2220,6 +2239,7 @@ class TestProcessAgainstStatus(PsutilTestCase):
          value = self.read_status_file("nonvoluntary_ctxt_switches:")
          self.assertEqual(self.proc.num_ctx_switches().involuntary, value)
  
@@ -205,10 +245,18 @@ index c9059e33..0050c42a 100755
      @unittest.skipIf(not POSIX, "POSIX only")
      def test_weird_environ(self):
 diff --git a/psutil/tests/test_system.py b/psutil/tests/test_system.py
-index db2cb348..411835d4 100755
+index db2cb348..d719c59e 100755
 --- a/psutil/tests/test_system.py
 +++ b/psutil/tests/test_system.py
-@@ -33,6 +33,7 @@ from psutil._compat import long
+@@ -10,6 +10,7 @@ import contextlib
+ import datetime
+ import errno
+ import os
++import platform
+ import pprint
+ import shutil
+ import signal
+@@ -33,6 +34,7 @@ from psutil._compat import long
  from psutil.tests import ASCII_FS
  from psutil.tests import CI_TESTING
  from psutil.tests import DEVNULL
@@ -216,7 +264,7 @@ index db2cb348..411835d4 100755
  from psutil.tests import GITHUB_ACTIONS
  from psutil.tests import GLOBAL_TIMEOUT
  from psutil.tests import HAS_BATTERY
-@@ -199,6 +200,7 @@ class TestMiscAPIs(PsutilTestCase):
+@@ -199,6 +201,7 @@ class TestMiscAPIs(PsutilTestCase):
          self.assertGreater(bt, 0)
          self.assertLess(bt, time.time())
  
@@ -224,7 +272,23 @@ index db2cb348..411835d4 100755
      @unittest.skipIf(CI_TESTING and not psutil.users(), "unreliable on CI")
      def test_users(self):
          users = psutil.users()
-@@ -580,6 +582,7 @@ class TestDiskAPIs(PsutilTestCase):
+@@ -426,6 +429,7 @@ class TestCpuAPIs(PsutilTestCase):
+                 if difference >= 0.05:
+                     return
+ 
++    @unittest.skipIf(GENTOO_TESTING, "flaky")
+     def test_cpu_times_comparison(self):
+         # Make sure the sum of all per cpu times is almost equal to
+         # base "one cpu" times.
+@@ -512,6 +516,7 @@ class TestCpuAPIs(PsutilTestCase):
+                 self.assertGreater(value, 0)
+ 
+     @unittest.skipIf(not HAS_CPU_FREQ, "not suported")
++    @unittest.skipIf(GENTOO_TESTING and 
platform.machine().startswith("sparc"), "broken on Gentoo/SPARC")
+     def test_cpu_freq(self):
+         def check_ls(ls):
+             for nt in ls:
+@@ -580,6 +585,7 @@ class TestDiskAPIs(PsutilTestCase):
      def test_disk_usage_bytes(self):
          psutil.disk_usage(b'.')
  

Reply via email to