def test_uptime_calc(self): psi_uptime = psi.uptime().timestamp() calc_uptime = time.time() - psi.boottime().timestamp() calc_min = calc_uptime - 2 calc_max = calc_uptime + 2 self.assert_(calc_min < psi_uptime < calc_max, "%s < %s < %s" % (calc_min, psi_uptime, calc_max))
def test_boottime_calc(self): psi_bt = psi.boottime() calc_bt = time.time() - psi.uptime().timestamp() calc_min = calc_bt - 2 calc_max = calc_bt + 2 self.assert_(calc_min < psi_bt.timestamp() < calc_max, '%s < %s < %s' % (calc_min, psi_bt.timestamp(), calc_max))
def get_uptime(): return psi.uptime().timestamp()
def check_psi(): psi.loadavg() psi.boottime() psi.uptime()
def test_uptime_gt_null(self): self.assert_(psi.uptime().timestamp() > 0)
def test_timedelta(self): ut = psi.uptime() self.assert_(isinstance(ut, psi.TimeSpec))