In my django project, I have some periodic celery tasks that are supposed to be executed after a certain time (when in testing mode, the waiting time is set as a few seconds). After execution of these periodic tasks, they will change some states of entities. I have written tests to check those states immediately after the periodic tasks are scheduled. I tried to use CELERY_ALWAYS_EAGER = True to test celery tasks in my django unit testing. However, with that setting, it waits for the tasks to be executed locally and results returned. So my previous testing code breaks because of this.
Anyone knows how you can test celery periodic tasks? Thanks.
Aucun commentaire:
Enregistrer un commentaire