<small id='usQWR'></small><noframes id='usQWR'>

      1. <legend id='usQWR'><style id='usQWR'><dir id='usQWR'><q id='usQWR'></q></dir></style></legend>
      2. <tfoot id='usQWR'></tfoot>
        • <bdo id='usQWR'></bdo><ul id='usQWR'></ul>
        <i id='usQWR'><tr id='usQWR'><dt id='usQWR'><q id='usQWR'><span id='usQWR'><b id='usQWR'><form id='usQWR'><ins id='usQWR'></ins><ul id='usQWR'></ul><sub id='usQWR'></sub></form><legend id='usQWR'></legend><bdo id='usQWR'><pre id='usQWR'><center id='usQWR'></center></pre></bdo></b><th id='usQWR'></th></span></q></dt></tr></i><div id='usQWR'><tfoot id='usQWR'></tfoot><dl id='usQWR'><fieldset id='usQWR'></fieldset></dl></div>

        如何在姜戈测试芹菜周期任务?

        How to test celery periodic_task in Django?(如何在姜戈测试芹菜周期任务?)

        <tfoot id='xJZ2s'></tfoot>

        <small id='xJZ2s'></small><noframes id='xJZ2s'>

                <bdo id='xJZ2s'></bdo><ul id='xJZ2s'></ul>
                <i id='xJZ2s'><tr id='xJZ2s'><dt id='xJZ2s'><q id='xJZ2s'><span id='xJZ2s'><b id='xJZ2s'><form id='xJZ2s'><ins id='xJZ2s'></ins><ul id='xJZ2s'></ul><sub id='xJZ2s'></sub></form><legend id='xJZ2s'></legend><bdo id='xJZ2s'><pre id='xJZ2s'><center id='xJZ2s'></center></pre></bdo></b><th id='xJZ2s'></th></span></q></dt></tr></i><div id='xJZ2s'><tfoot id='xJZ2s'></tfoot><dl id='xJZ2s'><fieldset id='xJZ2s'></fieldset></dl></div>

                  <tbody id='xJZ2s'></tbody>
                • <legend id='xJZ2s'><style id='xJZ2s'><dir id='xJZ2s'><q id='xJZ2s'></q></dir></style></legend>
                  本文介绍了如何在姜戈测试芹菜周期任务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个简单的定期任务:

                  from celery.decorators import periodic_task
                  from celery.task.schedules import crontab
                  from .models import Subscription
                  
                  @periodic_task(run_every=crontab(minute=0, hour=0))
                  def deactivate_subscriptions():
                      for subscription in Subscription.objects.filter(is_expired=True):
                          print(subscription)
                          subscription.is_active = False
                          subscription.can_activate = False
                          subscription.save()
                  

                  并且我想用测试来覆盖它。

                  我找到有关如何测试简单任务的信息,如@SHARED_TASK,但我在任何地方都找不到测试示例@periodic_task

                  推荐答案

                  使用函数apply()。Documentation for apply().

                  这篇关于如何在姜戈测试芹菜周期任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  groupby multiple coords along a single dimension in xarray(在xarray中按单个维度的多个坐标分组)
                  Group by and Sum in Pandas without losing columns(Pandas中的GROUP BY AND SUM不丢失列)
                  Group by + New Column + Grab value former row based on conditionals(GROUP BY+新列+基于条件的前一行抓取值)
                  Groupby and interpolate in Pandas(PANDA中的Groupby算法和插值算法)
                  Pandas - Group Rows based on a column and replace NaN with non-null values(PANAS-基于列对行进行分组,并将NaN替换为非空值)
                  Grouping pandas DataFrame by 10 minute intervals(按10分钟间隔对 pandas 数据帧进行分组)
                    <bdo id='4bUA7'></bdo><ul id='4bUA7'></ul>

                            <legend id='4bUA7'><style id='4bUA7'><dir id='4bUA7'><q id='4bUA7'></q></dir></style></legend>
                              <tbody id='4bUA7'></tbody>
                            <i id='4bUA7'><tr id='4bUA7'><dt id='4bUA7'><q id='4bUA7'><span id='4bUA7'><b id='4bUA7'><form id='4bUA7'><ins id='4bUA7'></ins><ul id='4bUA7'></ul><sub id='4bUA7'></sub></form><legend id='4bUA7'></legend><bdo id='4bUA7'><pre id='4bUA7'><center id='4bUA7'></center></pre></bdo></b><th id='4bUA7'></th></span></q></dt></tr></i><div id='4bUA7'><tfoot id='4bUA7'></tfoot><dl id='4bUA7'><fieldset id='4bUA7'></fieldset></dl></div>

                          • <tfoot id='4bUA7'></tfoot>
                          • <small id='4bUA7'></small><noframes id='4bUA7'>