Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
    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)