Exemplo n.º 1
0
 def schedule(self, delay, callable):
     self.calls.append((delay, callable))
     return schedule.ScheduledCall(delay, callable)
Exemplo n.º 2
0
 def test_order(self):
     now = vdsm.common.time.monotonic_time()
     call_soon = schedule.ScheduledCall(now, self.callback)
     call_later = schedule.ScheduledCall(now + 1, self.callback)
     self.assertLess(call_soon, call_later)
Exemplo n.º 3
0
 def test_execute(self):
     call = schedule.ScheduledCall(0, self.callback)
     call._execute()
     self.assertEqual(1, self.count)
     self.assertFalse(call.valid())
Exemplo n.º 4
0
 def test_execute_callback_once(self):
     call = schedule.ScheduledCall(0, self.callback)
     call._execute()
     call._execute()
     self.assertEqual(1, self.count)
Exemplo n.º 5
0
 def test_create(self):
     call = schedule.ScheduledCall(0, self.callback)
     self.assertEqual(0, self.count)
     self.assertTrue(call.valid())