def testBootTimeMalformed(self): with MonkeyPatchScope([(sampling, '_PROC_STAT_PATH', self._malformed_path)]): with self.assertRaises(ValueError): sampling.getBootTime()
def testBootTimeOk(self): with MonkeyPatchScope([(sampling, '_PROC_STAT_PATH', self._good_path)]): self.assertEquals(sampling.getBootTime(), 1395249141)
def testBootTimeEmpty(self): with MonkeyPatchScope([(sampling, '_PROC_STAT_PATH', '/dev/null')]): with self.assertRaises(ValueError): sampling.getBootTime()
def testBootTimeNonExistantFile(self): with MonkeyPatchScope([(sampling, '_PROC_STAT_PATH', '/i/do/not/exist/1234567890')]): with self.assertRaises(IOError): sampling.getBootTime()
def testBootTimeOk(self): with MonkeyPatchScope([(sampling, '_PROC_STAT_PATH', self._good_path) ]): self.assertEquals(sampling.getBootTime(), 1395249141)