class TestRunTime(TestCase): def setUp(self): print '%s %s' % (self.id(), self.shortDescription()) self.savedTimeProperty = RunTime.currentTime RunTime.currentTime = property(RunTime.getMockTime) RunTime.mockTime = 1.0 self.runTime = RunTime() def tearDown(self): RunTime.currentTime = self.savedTimeProperty def testCurrentTime(self): assert str(self.runTime) == "0:00.00" assert self.runTime.toString() == "0:00.00" def testTenMinutes(self): RunTime.mockTime = 601.0 assert str(self.runTime) == "10:00.00" assert self.runTime.toString() == "10:00.00" def testOneHourAndTenMinutes(self): RunTime.mockTime = 1 * 3600.0 + 10 * 60.0 + 1.0 assert str(self.runTime) == "1:10:00" assert self.runTime.toString() == "1:10:00"
def setUp(self): print '%s %s' % (self.id(), self.shortDescription()) self.savedTimeProperty = RunTime.currentTime RunTime.currentTime = property(RunTime.getMockTime) RunTime.mockTime = 1.0 self.runTime = RunTime()