def block(log): prev = PingTask.app.conf.CELERY_ALWAYS_EAGER PingTask.app.conf.CELERY_ALWAYS_EAGER = True try: return ping(), log[0].message finally: PingTask.app.conf.CELERY_ALWAYS_EAGER = prev
def test_ping(self): with self.assertWarnsRegex(CDeprecationWarning, r'ping task has been deprecated'): prev = PingTask.app.conf.CELERY_ALWAYS_EAGER PingTask.app.conf.CELERY_ALWAYS_EAGER = True try: self.assertEqual(ping(), "pong") finally: PingTask.app.conf.CELERY_ALWAYS_EAGER = prev
def test_ping(self): warnings.resetwarnings() with catch_warnings(record=True) as log: prev = PingTask.app.conf.CELERY_ALWAYS_EAGER PingTask.app.conf.CELERY_ALWAYS_EAGER = True try: pong = ping() warning = log[0].message self.assertEqual(pong, "pong") self.assertIsInstance(warning, CDeprecationWarning) self.assertIn("ping task has been deprecated", warning.args[0]) finally: PingTask.app.conf.CELERY_ALWAYS_EAGER = prev
def test_ping(self): self.assertEqual(task.ping(), 'pong')
def test_ping(self): from celery import conf conf.ALWAYS_EAGER = True self.assertEqual(task.ping(), 'pong') conf.ALWAYS_EAGER = False