From f331838cbca8f86027490c9b6799e238f8dd3dc8 Mon Sep 17 00:00:00 2001 From: hussein-awala Date: Fri, 15 Mar 2024 23:44:16 +0100 Subject: [PATCH] bump croniter to fix an issue with 29 Feb experssions --- pyproject.toml | 2 +- tests/models/test_dag.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6b68b2aeb86a7..519013a9cd39b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -85,7 +85,7 @@ dependencies = [ # This limit can be removed after https://github.com/apache/airflow/issues/35234 is fixed "connexion[flask]>=2.10.0,<3.0", "cron-descriptor>=1.2.24", - "croniter>=0.3.17", + "croniter>=2.0.2", "cryptography>=39.0.0", "deprecated>=1.2.13", "dill>=0.2.2", diff --git a/tests/models/test_dag.py b/tests/models/test_dag.py index 3e49df558de61..4dd29ecbe8c75 100644 --- a/tests/models/test_dag.py +++ b/tests/models/test_dag.py @@ -2544,6 +2544,19 @@ def subdag(parent_dag_name, child_dag_name, args): next_subdag_info = subdag.next_dagrun_info(None) assert next_subdag_info is None, "SubDags should never have DagRuns created by the scheduler" + def test_next_dagrun_info_on_29_feb(self): + dag = DAG( + "test_scheduler_dagrun_29_feb", start_date=timezone.datetime(2024, 1, 1), schedule="0 0 29 2 *" + ) + + next_info = dag.next_dagrun_info(None) + assert next_info and next_info.logical_date == timezone.datetime(2024, 2, 29) + + next_info = dag.next_dagrun_info(next_info.data_interval) + assert next_info.logical_date == timezone.datetime(2028, 2, 29) + assert next_info.data_interval.start == timezone.datetime(2028, 2, 29) + assert next_info.data_interval.end == timezone.datetime(2032, 2, 29) + def test_replace_outdated_access_control_actions(self): outdated_permissions = { "role1": {permissions.ACTION_CAN_READ, permissions.ACTION_CAN_EDIT},