[Python-modules-commits] [python-django-celery-beat] 07/16: Add patch to fix expired solar tests.

Michael Fladischer fladi at moszumanska.debian.org
Fri Nov 24 11:09:07 UTC 2017


This is an automated email from the git hooks/post-receive script.

fladi pushed a commit to branch debian/master
in repository python-django-celery-beat.

commit 74dc6c945eac25662813efafd6e81df0ecab62d6
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date:   Fri Nov 17 09:24:03 2017 +0100

    Add patch to fix expired solar tests.
---
 debian/changelog                                   |  1 +
 ...to-not-expire-relative-to-current-date.-A.patch | 42 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 44 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index d1bcc40..8e2ab15 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ python-django-celery-beat (1.1.0-1) UNRELEASED; urgency=low
 
   * New upstream release.
   * Clean up .cache to allow two builds in a row.
+  * Add patch to fix expired solar tests.
 
  -- Michael Fladischer <fladi at debian.org>  Mon, 13 Nov 2017 12:39:48 +0100
 
diff --git a/debian/patches/0001-Fixed-test-to-not-expire-relative-to-current-date.-A.patch b/debian/patches/0001-Fixed-test-to-not-expire-relative-to-current-date.-A.patch
new file mode 100644
index 0000000..41919ad
--- /dev/null
+++ b/debian/patches/0001-Fixed-test-to-not-expire-relative-to-current-date.-A.patch
@@ -0,0 +1,42 @@
+From: Daniel Devine <devine at ddevnet.net>
+Date: Fri, 28 Jul 2017 13:18:51 +1000
+Subject: Fixed test to not expire relative to current date. Added test to
+ check both if a task is due in addition to not due.
+
+---
+ t/unit/test_schedulers.py | 15 ++++++++++++---
+ 1 file changed, 12 insertions(+), 3 deletions(-)
+
+diff --git a/t/unit/test_schedulers.py b/t/unit/test_schedulers.py
+index 3b1538b..9d7efd0 100644
+--- a/t/unit/test_schedulers.py
++++ b/t/unit/test_schedulers.py
+@@ -439,16 +439,25 @@ class test_models(SchedulerCase):
+ 
+     def test_SolarSchedule_schedule(self):
+         s = SolarSchedule(event='solar_noon', latitude=48.06, longitude=12.86)
+-        dt = datetime(day=25, month=7, year=2017, hour=12, minute=0)
++        dt = datetime(day=26, month=7, year=2050, hour=1, minute=0)
+         dt_lastrun = make_aware(dt)
+ 
+         assert s.schedule is not None
+-
+         isdue, nextcheck = s.schedule.is_due(dt_lastrun)
+-        assert isdue is False  # False means scheduler needs to keep checking.
++        assert isdue is False  # False means task is not due, but keep checking.
+         assert (nextcheck > 0) and (isdue is False) or \
+             (nextcheck == s.max_interval) and (isdue is True)
+ 
++        s2 = SolarSchedule(event='solar_noon', latitude=48.06, longitude=12.86)
++        dt2 = datetime(day=26, month=7, year=2000, hour=1, minute=0)
++        dt2_lastrun = make_aware(dt2)
++
++        assert s2.schedule is not None
++        isdue2, nextcheck2 = s2.schedule.is_due(dt2_lastrun)
++        assert isdue2 is True  # True means task is due and should run.
++        assert (nextcheck2 > 0) and (isdue2 is True) or \
++            (nextcheck2 == s2.max_interval) and (isdue2 is False)
++
+ 
+ @pytest.mark.django_db()
+ class test_model_PeriodicTasks(SchedulerCase):
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..d453cdb
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-Fixed-test-to-not-expire-relative-to-current-date.-A.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-django-celery-beat.git



More information about the Python-modules-commits mailing list