Пример #1
0
 def setUp(self):
     # Scale time if configured
     scale = util.acquireAttribute(self._parents, "timescale", None)
     if scale is not None:
         time.scale(scale)
     else:
         time.reset()
     self.info("Test running with timescale: %r", time._get_scale())
Пример #2
0
    def testGettingTime(self):
        cur_time = python_time.time()
        our_time = time.time()
        self.assertApproximates(cur_time, our_time, 0.01)

        time.scale(0.1)
        cur_time = python_time.time()
        our_time = time.time()
        self.assertApproximates(cur_time /time._get_scale(), our_time, 0.01)
Пример #3
0
 def setUp(self):
     log.test_reset()
     self.assert_not_skipped()
     # Scale time if configured
     scale = util.acquireAttribute(self._parents, 'timescale', None)
     if scale is not None:
         time.scale(scale)
     else:
         time.reset()
     self.info("Test running with timescale: %r", time._get_scale())
Пример #4
0
    def testFutureTime(self):
        cur_time = python_time.time()
        fut_time = time.future(1)
        self.assertApproximates(cur_time + 1, fut_time, 0.01)

        time.scale(0.1)
        cur_time = python_time.time()
        fut_time = time.future(1)
        self.assertApproximates(cur_time / time._get_scale() + 1,
                                fut_time, 0.01)
        time_left = time.left(fut_time)
        self.assertApproximates(1, time_left, 0.01)