Esempio n. 1
0
 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
Esempio n. 2
0
 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
Esempio n. 3
0
 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
Esempio n. 4
0
    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
Esempio n. 5
0
 def test_ping(self):
     self.assertEqual(task.ping(), 'pong')
Esempio n. 6
0
 def test_ping(self):
     from celery import conf
     conf.ALWAYS_EAGER = True
     self.assertEqual(task.ping(), 'pong')
     conf.ALWAYS_EAGER = False
Esempio n. 7
0
 def test_ping(self):
     self.assertEqual(task.ping(), 'pong')