summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGiampaolo Rodola' <g.rodola@gmail.com>2013-04-27 18:35:10 +0200
committerGiampaolo Rodola' <g.rodola@gmail.com>2013-04-27 18:35:10 +0200
commit7e31b67956dacb0e6b704d6e4c4b0fe37faebbed (patch)
tree9dc4632689ff6100b36374bf53fefe936e0da5b8 /test
parentad7fe470bce703165a233495a3daee1330489e3e (diff)
downloadpsutil-cpu-temp.tar.gz
Issue 371: implement CPU temperature on Linux by parsing files in /sys/class/hwmon/hwmon0/temp1_*. It is probably incomplete compared to what we can get via lm-sensors though so care should be taken on whether adding this or not.cpu-temp
Diffstat (limited to 'test')
-rw-r--r--test/test_psutil.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/test_psutil.py b/test/test_psutil.py
index 3650e333..860de920 100644
--- a/test/test_psutil.py
+++ b/test/test_psutil.py
@@ -823,6 +823,17 @@ class TestCase(unittest.TestCase):
if (max([kernel_time, ktime]) - min([kernel_time, ktime])) > 0.1:
self.fail("expected: %s, found: %s" %(ktime, kernel_time))
+ if LINUX:
+ def test_cpu_temp(self):
+ ls = psutil.get_cpu_temp()
+ if not ls:
+ self.fail('psutil.get_cpu_temp() returns an empty list')
+ for item in ls:
+ assert item.name, item
+ assert item.temp >= 0, item
+ assert item.max >= 0, item
+ assert item.critical >= 0, item
+
def test_create_time(self):
sproc = get_test_subprocess(wait=True)
now = time.time()