85 lines
3.8 KiB
Diff
85 lines
3.8 KiB
Diff
diff --unified --recursive --text --new-file psutil-release-6.0.0.orig/psutil/tests/test_linux.py psutil-release-6.0.0/psutil/tests/test_linux.py
|
|
--- psutil-release-6.0.0.orig/psutil/tests/test_linux.py 2024-07-04 19:20:12.930686377 +0200
|
|
+++ psutil-release-6.0.0/psutil/tests/test_linux.py 2024-07-04 19:26:20.779890199 +0200
|
|
@@ -980,11 +980,6 @@
|
|
|
|
@unittest.skipIf(not LINUX, "LINUX only")
|
|
class TestSystemCPUStats(PsutilTestCase):
|
|
- def test_ctx_switches(self):
|
|
- vmstat_value = vmstat("context switches")
|
|
- psutil_value = psutil.cpu_stats().ctx_switches
|
|
- self.assertAlmostEqual(vmstat_value, psutil_value, delta=500)
|
|
-
|
|
def test_interrupts(self):
|
|
vmstat_value = vmstat("interrupts")
|
|
psutil_value = psutil.cpu_stats().interrupts
|
|
@@ -1010,48 +1005,6 @@
|
|
|
|
|
|
@unittest.skipIf(not LINUX, "LINUX only")
|
|
-class TestSystemNetIfAddrs(PsutilTestCase):
|
|
- def test_ips(self):
|
|
- for name, addrs in psutil.net_if_addrs().items():
|
|
- for addr in addrs:
|
|
- if addr.family == psutil.AF_LINK:
|
|
- self.assertEqual(addr.address, get_mac_address(name))
|
|
- elif addr.family == socket.AF_INET:
|
|
- self.assertEqual(addr.address, get_ipv4_address(name))
|
|
- self.assertEqual(addr.netmask, get_ipv4_netmask(name))
|
|
- if addr.broadcast is not None:
|
|
- self.assertEqual(
|
|
- addr.broadcast, get_ipv4_broadcast(name)
|
|
- )
|
|
- else:
|
|
- self.assertEqual(get_ipv4_broadcast(name), '0.0.0.0')
|
|
- elif addr.family == socket.AF_INET6:
|
|
- # IPv6 addresses can have a percent symbol at the end.
|
|
- # E.g. these 2 are equivalent:
|
|
- # "fe80::1ff:fe23:4567:890a"
|
|
- # "fe80::1ff:fe23:4567:890a%eth0"
|
|
- # That is the "zone id" portion, which usually is the name
|
|
- # of the network interface.
|
|
- address = addr.address.split('%')[0]
|
|
- self.assertIn(address, get_ipv6_addresses(name))
|
|
-
|
|
- # XXX - not reliable when having virtual NICs installed by Docker.
|
|
- # @unittest.skipIf(not which('ip'), "'ip' utility not available")
|
|
- # def test_net_if_names(self):
|
|
- # out = sh("ip addr").strip()
|
|
- # nics = [x for x in psutil.net_if_addrs().keys() if ':' not in x]
|
|
- # found = 0
|
|
- # for line in out.split('\n'):
|
|
- # line = line.strip()
|
|
- # if re.search(r"^\d+:", line):
|
|
- # found += 1
|
|
- # name = line.split(':')[1].strip()
|
|
- # self.assertIn(name, nics)
|
|
- # self.assertEqual(len(nics), found, msg="%s\n---\n%s" % (
|
|
- # pprint.pformat(nics), out))
|
|
-
|
|
-
|
|
-@unittest.skipIf(not LINUX, "LINUX only")
|
|
@unittest.skipIf(QEMU_USER, "QEMU user not supported")
|
|
class TestSystemNetIfStats(PsutilTestCase):
|
|
@unittest.skipIf(not which("ifconfig"), "ifconfig utility not available")
|
|
@@ -1445,19 +1398,6 @@
|
|
findmnt_value = sh("findmnt -o SOURCE -rn /")
|
|
self.assertEqual(psutil_value, findmnt_value)
|
|
|
|
- def test_disk_partitions_mocked(self):
|
|
- with mock.patch(
|
|
- 'psutil._pslinux.cext.disk_partitions',
|
|
- return_value=[('/dev/root', '/', 'ext4', 'rw')],
|
|
- ) as m:
|
|
- part = psutil.disk_partitions()[0]
|
|
- assert m.called
|
|
- if not GITHUB_ACTIONS:
|
|
- self.assertNotEqual(part.device, "/dev/root")
|
|
- self.assertEqual(part.device, RootFsDeviceFinder().find())
|
|
- else:
|
|
- self.assertEqual(part.device, "/dev/root")
|
|
-
|
|
|
|
# =====================================================================
|
|
# --- misc
|