示例#1
0
    def test_save_failed(self):
        """Failed tasks are saved to Redis"""
        tasks.raise_exception()
        with run_kuyruk(save_failed_tasks=True) as worker:
            worker.expect('ZeroDivisionError')
            worker.expect('No retry left')
            worker.expect('Saving failed task')
            worker.expect('Saved')
            worker.expect('Task is processed')

        assert is_empty('kuyruk')
        r = redis.StrictRedis()
        assert r.hvals('failed_tasks')

        run_requeue()
        assert not r.hvals('failed_tasks')
        assert not is_empty('kuyruk')
示例#2
0
    def test_save_failed(self):
        """Failed tasks are saved to Redis"""
        tasks.raise_exception()
        with run_kuyruk(save_failed_tasks=True) as worker:
            worker.expect("ZeroDivisionError")
            worker.expect("No retry left")
            worker.expect("Saving failed task")
            worker.expect("Saved")
            worker.expect("Task is processed")

        assert is_empty("kuyruk")
        r = redis.StrictRedis()
        assert r.hvals("failed_tasks")

        run_requeue()
        assert not r.hvals("failed_tasks")
        assert not is_empty("kuyruk")
示例#3
0
 def test_exception(self):
     """Errored task message is discarded"""
     tasks.raise_exception()
     with run_kuyruk() as worker:
         worker.expect('ZeroDivisionError')
     assert is_empty('kuyruk')