Exemple #1
0
 def schedule(self, delay, callable):
     self.calls.append((delay, callable))
     return schedule.ScheduledCall(delay, callable)
Exemple #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)
Exemple #3
0
 def test_execute(self):
     call = schedule.ScheduledCall(0, self.callback)
     call._execute()
     self.assertEqual(1, self.count)
     self.assertFalse(call.valid())
Exemple #4
0
 def test_execute_callback_once(self):
     call = schedule.ScheduledCall(0, self.callback)
     call._execute()
     call._execute()
     self.assertEqual(1, self.count)
Exemple #5
0
 def test_create(self):
     call = schedule.ScheduledCall(0, self.callback)
     self.assertEqual(0, self.count)
     self.assertTrue(call.valid())