Ejemplo n.º 1
0
    def test_day_after_dst_start(self):
        # Test for #1604 issue with region configuration using DST
        tzname = "Europe/Paris"
        self.app.timezone = tzname
        tz = pytz.timezone(tzname)
        crontab = self.crontab(minute=0, hour=9)

        # Set last_run_at Before DST start
        last_run_at = tz.localize(datetime(2017, 3, 25, 9, 0))
        # Set now after DST start
        now = tz.localize(datetime(2017, 3, 26, 7, 0))
        crontab.nowfun = lambda: now
        next = now + crontab.remaining_estimate(last_run_at)

        assert next.utcoffset().seconds == 7200
        assert next == tz.localize(datetime(2017, 3, 26, 9, 0))
Ejemplo n.º 2
0
 def next_ocurrance(self, crontab, now):
     crontab.nowfun = lambda: now
     return now + crontab.remaining_estimate(now)
Ejemplo n.º 3
0
 def next_ocurrance(self, crontab, now):
     crontab.nowfun = lambda: now
     return now + crontab.remaining_estimate(now)