Python 芹菜:控制测试中任务的执行

Python 芹菜:控制测试中任务的执行,python,celery,Python,Celery,pytest的测试非常方便 但我想拥有更多的控制权 我想从我的测试中手动控制worker 例如: def test_mytask(celery_worker): celery_worker.stop() # <--- I am missing this method mytask.delay() ...check state before execution of task celery_worker.process_one_task() # &l

pytest的测试非常方便

但我想拥有更多的控制权

我想从我的测试中手动控制worker

例如:

def test_mytask(celery_worker):

    celery_worker.stop()  # <--- I am missing this method

    mytask.delay()

    ...check state before execution of task

    celery_worker.process_one_task() # <--- I am missing this method

    ...check state after execution of task
def测试任务(芹菜工人):
芹菜工人#