dstandish commented on code in PR #35887:
URL: https://github.com/apache/airflow/pull/35887#discussion_r1416794086


##########
tests/timetables/test_interval_timetable.py:
##########
@@ -253,3 +253,308 @@ def 
test_cron_next_dagrun_info_alignment(last_data_interval: DataInterval, expec
         restriction=TimeRestriction(None, None, True),
     )
     assert info == expected_info
+
+
+class TestCronIntervalDst:
+    """Test cron interval timetable can correctly enter a DST boundary.
+
+    Zurich (Switzerland) is chosen since it is +1/+2 DST, making it a bit 
easier
+    to get my head around the mental timezone conversion.
+
+    In 2023, DST entered on 26th Mar, 2am local clocks (1am UTC) were turned
+    forward to 3am. DST exited on 29th Oct, 3am local clocks (1am UTC) were
+    turned backward to 2am (making the 2:XX hour fold).
+    """
+
+    def test_entering_exact(self) -> None:
+        timetable = CronDataIntervalTimetable("0 3 * * *", 
timezone="Europe/Zurich")
+        restriction = TimeRestriction(
+            earliest=pendulum.datetime(2023, 3, 24, tz=TIMEZONE),
+            latest=None,
+            catchup=True,
+        )
+
+        # Last run before DST. Interval starts and ends on 2am UTC (local time 
is +1).
+        next_info = 
timetable.next_dagrun_info(last_automated_data_interval=None, 
restriction=restriction)
+        assert next_info and next_info.data_interval == DataInterval(
+            pendulum.datetime(2023, 3, 24, 2, tz=TIMEZONE),

Review Comment:
   to me, fwiw, i think it would also be easier to reason about the tests if we 
compared in native UTC datetimes



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to