Skip testing cpu_load_percent if psutil module is not available

This commit is contained in:
ZyX 2014-12-08 21:15:39 +03:00
parent c617dbe6d8
commit 9e454235b3
1 changed files with 4 additions and 0 deletions

View File

@ -721,6 +721,10 @@ class TestSys(TestCommon):
])
def test_cpu_load_percent(self):
try:
__import__('psutil')
except ImportError as e:
raise SkipTest('Failed to import psutil: {0}'.format(e))
pl = Pl()
with replace_module_module(self.module, 'psutil', cpu_percent=lambda **kwargs: 52.3):
self.assertEqual(common.cpu_load_percent(pl=pl), [{