diff options
| author | Giampaolo Rodola <g.rodola@gmail.com> | 2017-01-24 15:56:32 +0100 |
|---|---|---|
| committer | Giampaolo Rodola <g.rodola@gmail.com> | 2017-01-24 15:56:32 +0100 |
| commit | 1fd9d80c374382d010ee7e44944bcd0bde4bbb41 (patch) | |
| tree | 4116c736ffadcf50cb404a7a1a7a81a6c704a048 /psutil/tests/test_linux.py | |
| parent | de2bce900d5c4be75091ffc50ab99abb1d77f387 (diff) | |
| download | psutil-1fd9d80c374382d010ee7e44944bcd0bde4bbb41.tar.gz | |
add linux specifc test for cpu_count()
Diffstat (limited to 'psutil/tests/test_linux.py')
| -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 37352ecf..2a444592 100755 --- a/psutil/tests/test_linux.py +++ b/psutil/tests/test_linux.py @@ -462,6 +462,14 @@ class TestSystemCPU(unittest.TestCase): else: self.assertNotIn('guest_nice', fields) + @unittest.skipUnless(os.path.exists("/sys/devices/system/cpu/possible"), + "/sys/devices/system/cpu/possible does not exist") + def test_cpu_count(self): + with open("/sys/devices/system/cpu/possible", "rb") as f: + data = f.read().strip() + highest = int(data.split('-')[1]) + 1 + self.assertEqual(psutil.cpu_count(), highest) + @unittest.skipUnless(os.path.exists("/sys/devices/system/cpu/online"), "/sys/devices/system/cpu/online does not exist") def test_cpu_count_logical_w_sysdev_cpu_online(self): |
