summaryrefslogtreecommitdiff
path: root/psutil/tests
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2020-10-17 04:57:36 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2020-10-17 04:57:36 +0200
commitbfae1fc4a371c9e08f2c3f5053a80542e43d18f7 (patch)
tree886c46ed0363029c5f4ad7ce89c0ef6eefe31077 /psutil/tests
parentf1e2137e9f7198a087ccf706201c648313bdae5a (diff)
downloadpsutil-bfae1fc4a371c9e08f2c3f5053a80542e43d18f7.tar.gz
linux / cpu_count phys: take depreated */thread_siblings_list into
account /sys/devices/system/cpu/cpu[0-9]*/topology/thread_siblings_list is deprecated /sys/devices/system/cpu/cpu[0-9]*/topology/core_cpus_list is the new name also add test which makes sure method 1 and 2 return the same result
Diffstat (limited to 'psutil/tests')
-rwxr-xr-xpsutil/tests/test_linux.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/psutil/tests/test_linux.py b/psutil/tests/test_linux.py
index 0d247aa5..b303ed6d 100755
--- a/psutil/tests/test_linux.py
+++ b/psutil/tests/test_linux.py
@@ -734,6 +734,14 @@ class TestSystemCPUCountPhysical(PsutilTestCase):
core_ids.add(fields[1])
self.assertEqual(psutil.cpu_count(logical=False), len(core_ids))
+ def test_method_2(self):
+ meth_1 = psutil._pslinux.cpu_count_physical()
+ with mock.patch('glob.glob', return_value=[]) as m:
+ meth_2 = psutil._pslinux.cpu_count_physical()
+ assert m.called
+ if meth_1 is not None:
+ self.assertEqual(meth_1, meth_2)
+
def test_emulate_none(self):
with mock.patch('glob.glob', return_value=[]) as m1:
with mock.patch('psutil._common.open', create=True) as m2: