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 | |
parent | de2bce900d5c4be75091ffc50ab99abb1d77f387 (diff) | |
download | psutil-1fd9d80c374382d010ee7e44944bcd0bde4bbb41.tar.gz |
add linux specifc test for cpu_count()
-rw-r--r-- | IDEAS | 2 | ||||
-rwxr-xr-x | psutil/tests/test_linux.py | 8 |
2 files changed, 8 insertions, 2 deletions
@@ -79,8 +79,6 @@ FEATURES - Number of system threads. - Windows: http://msdn.microsoft.com/en-us/library/windows/desktop/ms684824(v=vs.85).aspx -- #357: what CPU a process is on. - - Doc / wiki which compares similarities between UNIX cli tools and psutil. Example: ``` 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): |