summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2017-01-24 15:56:32 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2017-01-24 15:56:32 +0100
commit1fd9d80c374382d010ee7e44944bcd0bde4bbb41 (patch)
tree4116c736ffadcf50cb404a7a1a7a81a6c704a048
parentde2bce900d5c4be75091ffc50ab99abb1d77f387 (diff)
downloadpsutil-1fd9d80c374382d010ee7e44944bcd0bde4bbb41.tar.gz
add linux specifc test for cpu_count()
-rw-r--r--IDEAS2
-rwxr-xr-xpsutil/tests/test_linux.py8
2 files changed, 8 insertions, 2 deletions
diff --git a/IDEAS b/IDEAS
index 015b5fff..247b8b38 100644
--- a/IDEAS
+++ b/IDEAS
@@ -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):