1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
Description: fix test failure when run early
Since introduction of the "until" job scheduling method to apply deadlines,
the test_until_time fails when run between midnight and 5am local hour.
This patch ought to ensure the deadline is always one hour ago independently
of the time of the day, or night.
Author: Étienne Mollier <emollier@debian.org>
Bug: https://github.com/dbader/schedule/issues/488
Bug-Debian: https://bugs.debian.org/1030455
Forwarded: https://github.com/dbader/schedule/pull/563
Last-Update: 2023-02-15
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- schedule-1.1.0.orig/test_schedule.py
+++ schedule-1.1.0/test_schedule.py
@@ -314,7 +314,8 @@
self.assertRaises(
ScheduleValueError, every().day.until, datetime.timedelta(minutes=-1)
)
- self.assertRaises(ScheduleValueError, every().day.until, datetime.time(hour=5))
+ one_hour_ago = datetime.datetime.now() - datetime.timedelta(hours=1)
+ self.assertRaises(ScheduleValueError, every().day.until, one_hour_ago)
# Unschedule job after next_run passes the deadline
schedule.clear()
|