示例#1
0
    def waste_time():
        """Waste a small amount of time (~1 second).

        This uses the cube_util.synchronize function (which does
        a busy wait).
        """

        cube_util.synchronize(time.time() + random.gauss(1.0, 0.24))
    def waste_time():
        """Waste a small amount of time (~1 second).

        This uses the cube_util.synchronize function (which does
        a busy wait).
        """

        cube_util.synchronize(time.time() + random.gauss(1.0, 0.24))
    def test_synchronize(self):
        """Test the synchronize function."""

        sync_time = time.time() + 3.0  # 3 seconds in the future
        cube_util.synchronize(sync_time)
        finish_time = time.time()
        self.assertAlmostEqual(sync_time, finish_time, delta=0.1,
                               msg="finish_time did not match sync_time")
示例#4
0
    def test_synchronize(self):
        """Test the synchronize function."""

        sync_time = time.time() + 3.0  # 3 seconds in the future
        cube_util.synchronize(sync_time)
        finish_time = time.time()
        self.assertAlmostEqual(sync_time,
                               finish_time,
                               delta=0.1,
                               msg="finish_time did not match sync_time")