diff options
| author | Giampaolo Rodola <g.rodola@gmail.com> | 2019-03-14 20:07:11 +0100 |
|---|---|---|
| committer | Giampaolo Rodola <g.rodola@gmail.com> | 2019-03-14 20:07:11 +0100 |
| commit | b583b8b10d744412f0ecd0f8265f6cf73b147d77 (patch) | |
| tree | 452de5175867a26f7c090ab507a75bc5644fe0b2 /psutil/tests/test_linux.py | |
| parent | fc423782b90168344f29597bb0200cf11fe035dc (diff) | |
| download | psutil-b583b8b10d744412f0ecd0f8265f6cf73b147d77.tar.gz | |
issue #1404 / linux / phys CPUs count
determine CPUs from /sys/devices/system/cpu/cpu[0-9]/topology/core_id in
case /proc/cpuinfo does not provide this info
Diffstat (limited to 'psutil/tests/test_linux.py')
| -rwxr-xr-x | psutil/tests/test_linux.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/psutil/tests/test_linux.py b/psutil/tests/test_linux.py index 394ce654..66c50aa6 100755 --- a/psutil/tests/test_linux.py +++ b/psutil/tests/test_linux.py @@ -685,10 +685,12 @@ class TestSystemCPUCountPhysical(unittest.TestCase): core_ids.add(fields[1]) self.assertEqual(psutil.cpu_count(logical=False), len(core_ids)) - def test_emulate_empty_cpuinfo(self): - with mock.patch('psutil._common.open', create=True) as m: - self.assertIsNone(psutil._pslinux.cpu_count_physical()) - assert m.called + def test_emulate_none(self): + with mock.patch('glob.glob', return_value=[]) as m1: + with mock.patch('psutil._common.open', create=True) as m2: + self.assertIsNone(psutil._pslinux.cpu_count_physical()) + assert m1.called + assert m2.called @unittest.skipIf(not LINUX, "LINUX only") |
