This is an automated email from the ASF dual-hosted git repository.

shahar1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new c6690015a28 Parametrize airflowctl partition-date tests (#75902)
c6690015a28 is described below

commit c6690015a28b0a89e9aa494dc92edc0b180d24de
Author: Hussein Awala <[email protected]>
AuthorDate: Thu Oct 29 06:23:17 2026 +0100

    Parametrize airflowctl partition-date tests (#75902)
---
 .../airflow_ctl/ctl/commands/test_dag_command.py   | 46 +++++-----------------
 1 file changed, 10 insertions(+), 36 deletions(-)

diff --git a/airflow-ctl/tests/airflow_ctl/ctl/commands/test_dag_command.py 
b/airflow-ctl/tests/airflow_ctl/ctl/commands/test_dag_command.py
index a714dfcd1bf..a11b83adee2 100644
--- a/airflow-ctl/tests/airflow_ctl/ctl/commands/test_dag_command.py
+++ b/airflow-ctl/tests/airflow_ctl/ctl/commands/test_dag_command.py
@@ -622,40 +622,14 @@ class TestDagCommands:
             ),
         )
 
-    def test_clear_by_partition_date_uses_calendar_dates_from_datetimes(self):
-        api_client = self._api_client_mock()
-        api_client.dag_runs.list.return_value = SimpleNamespace(
-            dag_runs=[self._dag_run("scheduled__2025-01-01")],
-            total_entries=1,
-        )
-        api_client.tasks.clear.return_value = SimpleNamespace(total_entries=1)
-
-        result = dag_command.clear(
-            self.parser.parse_args(
-                [
-                    "dags",
-                    "clear",
-                    self.dag_id,
-                    "--partition-date-start",
-                    "2025-01-01T08:00:00+08:00",
-                    "--partition-date-end",
-                    "2025-01-02T17:00:00+08:00",
-                    "--yes",
-                ]
-            ),
-            api_client=api_client,
-        )
-
-        assert result == {"dag_run_count": 1, "cleared_task_instances": 1}
-        api_client.dag_runs.list.assert_called_once_with(
-            dag_id=self.dag_id,
-            offset=0,
-            order_by="partition_date",
-            partition_date_gte=datetime.date(2025, 1, 1),
-            partition_date_lte=datetime.date(2025, 1, 2),
-        )
-
-    def 
test_clear_by_partition_date_accepts_naive_datetime_as_calendar_date(self):
+    @pytest.mark.parametrize(
+        ("start", "end"),
+        [
+            pytest.param("2025-01-01T08:00:00+08:00", 
"2025-01-02T17:00:00+08:00", id="aware"),
+            pytest.param("2025-01-01T00:00:00", "2025-01-02T00:00:00", 
id="naive"),
+        ],
+    )
+    def test_clear_by_partition_date_uses_calendar_dates_from_datetimes(self, 
start, end):
         api_client = self._api_client_mock()
         api_client.dag_runs.list.return_value = SimpleNamespace(
             dag_runs=[self._dag_run("scheduled__2025-01-01")],
@@ -670,9 +644,9 @@ class TestDagCommands:
                     "clear",
                     self.dag_id,
                     "--partition-date-start",
-                    "2025-01-01T00:00:00",
+                    start,
                     "--partition-date-end",
-                    "2025-01-02T00:00:00",
+                    end,
                     "--yes",
                 ]
             ),

Reply via email to