summaryrefslogtreecommitdiff
path: root/psutil/tests/test_linux.py
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2019-03-14 20:07:11 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2019-03-14 20:07:11 +0100
commitb583b8b10d744412f0ecd0f8265f6cf73b147d77 (patch)
tree452de5175867a26f7c090ab507a75bc5644fe0b2 /psutil/tests/test_linux.py
parentfc423782b90168344f29597bb0200cf11fe035dc (diff)
downloadpsutil-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-xpsutil/tests/test_linux.py10
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")