diff options
Diffstat (limited to 'psutil/tests/test_system.py')
-rwxr-xr-x | psutil/tests/test_system.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/psutil/tests/test_system.py b/psutil/tests/test_system.py index 18a5ae2d..79ae6bba 100755 --- a/psutil/tests/test_system.py +++ b/psutil/tests/test_system.py @@ -29,6 +29,7 @@ from psutil import POSIX from psutil import SUNOS from psutil import WINDOWS from psutil._compat import long +from psutil._compat import unicode from psutil.tests import AF_INET6 from psutil.tests import APPVEYOR from psutil.tests import check_net_address @@ -755,6 +756,21 @@ class TestSystemAPIs(unittest.TestCase): for name in names: self.assertIs(getattr(psutil, name), False, msg=name) + @unittest.skipUnless(hasattr(psutil, "sensors_temperatures"), + "platform not suported") + def test_sensors_temperatures(self): + temps = psutil.sensors_temperatures() + for name, entries in temps.items(): + self.assertIsInstance(name, (str, unicode)) + for entry in entries: + self.assertIsInstance(entry.label, (str, unicode)) + if entry.current is not None: + self.assertGreaterEqual(entry.current, 0) + if entry.high is not None: + self.assertGreaterEqual(entry.high, 0) + if entry.critical is not None: + self.assertGreaterEqual(entry.critical, 0) + if __name__ == '__main__': run_test_module_by_name(__file__) |