def test_returns_zero_for_empty_history(self): self.host_os.cpu_times_shifted.return_value = None for state in CPU_TIMES: percent = cpu.util('all', state=state, host_os=self.host_os) assert_is_instance(percent, float) assert_equal(0, percent)
def test_returns_float_less_than_hundred(self): for state in CPU_TIMES: percent = cpu.util('all', state=state, host_os=self.host_os) assert_is_instance(percent, float) assert_greater(100, percent)
def test_does_not_raise_exception_for_cpu_all(self): cpu.util('all', host_os=self.host_os)