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')
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")
def test_exception(self): """Errored task message is discarded""" tasks.raise_exception() with run_kuyruk() as worker: worker.expect('ZeroDivisionError') assert is_empty('kuyruk')