

def test_birth_and_death_registration(self):
    "\n        When scheduler registers it's birth, besides creating a key, it should\n        also set an expiry that's a few seconds longer than it's polling\n        interval so it automatically expires if scheduler is unexpectedly\n        terminated.\n        "
    key = Scheduler.scheduler_key
    self.assertNotIn(key, tl(self.testconn.keys('*')))
    scheduler = Scheduler(connection=self.testconn, interval=20)
    scheduler.register_birth()
    self.assertIn(key, tl(self.testconn.keys('*')))
    self.assertEqual(self.testconn.ttl(key), 30)
    self.assertFalse(self.testconn.hexists(key, 'death'))
    self.assertRaises(ValueError, scheduler.register_birth)
    scheduler.register_death()
    scheduler.assertTrue(self.testconn.hexists(key, 'death'))

dataset/ETHPy150Open ui/rq-scheduler/tests/test_scheduler.py TestScheduler.test_birth_and_death_registration/VarMisuse@126/245 `self`->`scheduler`