mirror of
https://github.com/powerline/powerline.git
synced 2025-07-26 23:35:04 +02:00
Skip testing cpu_load_percent if psutil module is not available
This commit is contained in:
parent
c617dbe6d8
commit
9e454235b3
@ -721,6 +721,10 @@ class TestSys(TestCommon):
|
|||||||
])
|
])
|
||||||
|
|
||||||
def test_cpu_load_percent(self):
|
def test_cpu_load_percent(self):
|
||||||
|
try:
|
||||||
|
__import__('psutil')
|
||||||
|
except ImportError as e:
|
||||||
|
raise SkipTest('Failed to import psutil: {0}'.format(e))
|
||||||
pl = Pl()
|
pl = Pl()
|
||||||
with replace_module_module(self.module, 'psutil', cpu_percent=lambda **kwargs: 52.3):
|
with replace_module_module(self.module, 'psutil', cpu_percent=lambda **kwargs: 52.3):
|
||||||
self.assertEqual(common.cpu_load_percent(pl=pl), [{
|
self.assertEqual(common.cpu_load_percent(pl=pl), [{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user