我想在运行单元测试时检索在tasks.py
中注册的所有任务的列表。在
在我正常的环境中,我使用电流_应用程序任务要检索任务列表,但不幸的是,在运行测试时,该列表只返回:
<@task: celery.backend_cleanup of default:0x35d27b0>
<@task: celery.chain of default:0x35d27b0>
<@task: celery.chord of default:0x35d27b0>
<@task: celery.chord_unlock of default:0x35d27b0>
<@task: celery.chunks of default:0x35d27b0>
<@task: celery.group of default:0x35d27b0>
<@task: celery.map of default:0x35d27b0>
<@task: celery.starmap of default:0x35d27b0>
Celery任务正在导入时添加和评估,考虑到我的模型是调用任务的模型,它们只是还没有导入到当前的应用程序中。在
一个简单的解决方案就是在单元测试文件夹上做一个
import tasks
。在新手错误。在
相关问题 更多 >
编程相关推荐