Browse Source

Fix crontab that use month of year and day of month

This patch fix the use of periodic tasks with
both month_of_year and day_of_month.

Before this patch, in July for a tasks that should
run in February, the periodic task run again and
again. Celery believes it is 5 months late when
it is 7 month in advance.
Guillaume Gauvrit 11 years ago
parent
commit
98c4ed95ce
1 changed files with 3 additions and 4 deletions
  1. 3 4
      celery/tests/tasks/test_tasks.py

+ 3 - 4
celery/tests/tasks/test_tasks.py

@@ -1276,10 +1276,9 @@ class test_crontab_is_due(AppCase):
         due, remaining = monthly_moy.run_every.is_due(
             datetime(2013, 6, 28, 22, 14))
         self.assertFalse(due)
-        attempt = (
-            time.mktime(datetime(2014, 2, 26, 22, 0).timetuple()) -
-            time.mktime(datetime(2013, 6, 28, 14, 30).timetuple()) -
-            60 * 60
+        attempt = (time.mktime(datetime(2014, 2, 26, 22, 0).timetuple())
+                   - time.mktime(datetime(2013, 6, 28, 14, 30).timetuple())
+                   - 60 * 60
         )
         self.assertEqual(remaining, attempt)