diff options
| author | Giampaolo Rodola <g.rodola@gmail.com> | 2020-10-17 04:57:36 +0200 |
|---|---|---|
| committer | Giampaolo Rodola <g.rodola@gmail.com> | 2020-10-17 04:57:36 +0200 |
| commit | bfae1fc4a371c9e08f2c3f5053a80542e43d18f7 (patch) | |
| tree | 886c46ed0363029c5f4ad7ce89c0ef6eefe31077 /psutil/tests | |
| parent | f1e2137e9f7198a087ccf706201c648313bdae5a (diff) | |
| download | psutil-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-x | psutil/tests/test_linux.py | 8 |
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: |
