Esempio n. 1
0
 def test_retry(self):
     """Errored task is retried"""
     tasks.retry_task()
     with run_kuyruk() as worker:
         worker.expect('ZeroDivisionError')
         worker.expect('ZeroDivisionError')
     assert len_queue("kuyruk") == 0
Esempio n. 2
0
 def test_reject(self):
     """Rejected task is requeued"""
     tasks.rejecting_task()
     with run_kuyruk() as worker:
         worker.expect('Task is rejected')
         worker.expect('Task is rejected')
     assert len_queue("kuyruk") == 1
Esempio n. 3
0
 def test_reject(self):
     """Rejected task is requeued"""
     tasks.rejecting_task()
     with run_kuyruk() as worker:
         worker.expect('Task is rejected')
         worker.expect('Task is rejected')
     assert len_queue("kuyruk") == 1
Esempio n. 4
0
 def test_simple_task(self):
     """Run a task on default queue"""
     tasks.echo('hello world')
     with run_kuyruk() as worker:
         worker.expect('Consumer started')
         worker.expect('hello world')
         worker.expect('Task is processed')
Esempio n. 5
0
 def test_retry(self):
     """Errored task is retried"""
     tasks.retry_task()
     with run_kuyruk() as worker:
         worker.expect('ZeroDivisionError')
         worker.expect('ZeroDivisionError')
     assert len_queue("kuyruk") == 0
Esempio n. 6
0
 def test_simple_task(self):
     """Run a task on default queue"""
     tasks.echo('hello world')
     with run_kuyruk() as worker:
         worker.expect('Consumer started')
         worker.expect('hello world')
         worker.expect('Task is processed')
Esempio n. 7
0
 def test_before_after(self, presend_mock):
     """Run signal handlers"""
     tasks.task_with_signal_handlers('hello world')
     presend_mock.assert_called_once()
     with run_kuyruk() as worker:
         worker.expect('function2')
         worker.expect('hello world')
         worker.expect('function5')
Esempio n. 8
0
 def test_another_queue(self):
     """Run a task on another queue"""
     tasks.echo_another('hello another')
     with run_kuyruk(queue='another_queue') as worker:
         worker.expect('Consumer started')
         worker.expect('another_queue')
         worker.expect('hello another')
         worker.expect('Task is processed')
Esempio n. 9
0
 def test_before_after(self, presend_mock):
     """Run signal handlers"""
     tasks.task_with_signal_handlers('hello world')
     presend_mock.assert_called_once()
     with run_kuyruk() as worker:
         worker.expect('function2')
         worker.expect('hello world')
         worker.expect('function5')
Esempio n. 10
0
 def test_another_queue(self):
     """Run a task on another queue"""
     tasks.echo_another('hello another')
     with run_kuyruk(queue='another_queue') as worker:
         worker.expect('Consumer started')
         worker.expect('another_queue')
         worker.expect('hello another')
         worker.expect('Task is processed')
Esempio n. 11
0
 def test_worker_sigquit(self):
     """Ack current message and exit"""
     tasks.loop_forever()
     with run_kuyruk() as worker:
         worker.expect('looping forever')
         pid = get_pid('kuyruk: worker')
         os.kill(pid, signal.SIGUSR2)
         worker.expect('Dropping current task')
     assert len_queue("kuyruk") == 0, worker.get_output()
Esempio n. 12
0
 def test_worker_sigquit(self):
     """Ack current message and exit"""
     tasks.loop_forever()
     with run_kuyruk() as worker:
         worker.expect('looping forever')
         pid = get_pid('kuyruk: worker')
         os.kill(pid, signal.SIGUSR2)
         worker.expect('Dropping current task')
     assert len_queue("kuyruk") == 0, worker.get_output()
Esempio n. 13
0
 def test_max_run_time(self):
     """Timeout long running task"""
     run_time = tasks.sleeping_task.max_run_time + 0.1
     tasks.sleeping_task(run_time)
     with run_kuyruk() as worker:
         worker.expect('Timeout')
Esempio n. 14
0
 def test_exception(self):
     """Errored task message is discarded"""
     tasks.raise_exception()
     with run_kuyruk() as worker:
         worker.expect('ZeroDivisionError')
     assert len_queue("kuyruk") == 0
Esempio n. 15
0
 def test_max_run_time(self):
     """Timeout long running task"""
     run_time = tasks.sleeping_task.max_run_time + 0.1
     tasks.sleeping_task(run_time)
     with run_kuyruk() as worker:
         worker.expect('Timeout')
Esempio n. 16
0
 def test_exception(self):
     """Errored task message is discarded"""
     tasks.raise_exception()
     with run_kuyruk() as worker:
         worker.expect('ZeroDivisionError')
     assert len_queue("kuyruk") == 0