def test_chord(self, test_name): canvas = celery.chord([ order_task.s( test_name, f'task{task_nr}', ) for task_nr in range(1, 6) ], order_task.s(test_name, 'last')) assert (self.get_canvas_order(canvas, )[test_name])[-1] == 'last'
def test_group(self, test_name): canvas = celery.group([ order_task.s(test_name, f'task{task_nr}') for task_nr in range(1, 6) ]) assert set(self.get_canvas_order(canvas, )[test_name]) == { 'task1', 'task2', 'task3', 'task4', 'task5' }
def test_combination(self, test_name): canvas = celery.group(order_task.s(test_name, 'task1a'), order_task.s(test_name, 'task1b')) | \ order_task.s(test_name, 'task2') | order_task.s(test_name, 'task3') | \ celery.group(order_task.s(test_name, 'task4a'), order_task.s(test_name, 'task4b')) | \ order_task.s(test_name, 'task5') order = self.get_canvas_order(canvas, )[test_name] assert set(order[:2]) == {'task1a', 'task1b'} assert order[2:4] == ['task2', 'task3'] assert set(order[4:6]) == {'task4a', 'task4b'} assert order[6] == 'task5'
def test_chain(self, test_name): canvas = celery.chain(order_task.s(test_name, 'task1'), order_task.s(test_name, 'task2'), order_task.s(test_name, 'task3')) assert (self.get_canvas_order( canvas, )[test_name]) == ['task1', 'task2', 'task3']
def test_single_task(self, test_name): canvas = order_task.s(test_name, 'task1') assert self.get_canvas_order(canvas, )[test_name] == ['task1']