def test_absolutesleep(self): signal.signal(signal.SIGALRM, catcher) start = s = time.time() try: itimer.alarm(2.0) itimer.absolutesleep(10.0) finally: signal.signal(signal.SIGALRM, signal.SIG_DFL) self.assertAlmostEqual(time.time() - start, 10.0, places=2)
def sleep(self, delay): """sleep(<secs>) Pause the current thread of execution for <secs> seconds. Use this instead of time.sleep() since it works with the scheduler, and allows other events to run. """ itimer.absolutesleep(delay)