

def test_job_with_intervals_get_rescheduled(self):
    '\n        Ensure jobs with interval attribute are put back in the scheduler\n        '
    time_now = datetime.utcnow()
    interval = 10
    job = self.scheduler.schedule(time_now, say_hello, interval=interval)
    self.scheduler.enqueue_job(job)
    self.assertIn(job.id, tl(self.testconn.zrange(self.scheduler.scheduled_jobs_key, 0, 1)))
    self.assertEqual(self.testconn.zscore(self.scheduler.scheduled_jobs_key, job.id), (to_unix(time_now) + interval))
    job = self.scheduler.enqueue_periodic(time_now, interval, None, say_hello)
    self.scheduler.enqueue_job(job)
    self.assertIn(job.id, tl(self.testconn.zrange(self.scheduler.scheduled_jobs_key, 0, 1)))
    self.assertEqual(self.testconn.zscore(self.scheduler.scheduled_jobs_key, job.id), (to_unix(time_now) + interval))

dataset/ETHPy150Open ui/rq-scheduler/tests/test_scheduler.py TestScheduler.test_job_with_intervals_get_rescheduled/original