This is an automated email from the ASF dual-hosted git repository.
potiuk 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 8cd988dad76 Fix MyPy type errors in test_dags.py (#56735) (#56770)
8cd988dad76 is described below
commit 8cd988dad76340de00edd61c8d13ba7e1ecfef23
Author: Yeonguk Choo <[email protected]>
AuthorDate: Sun Oct 19 02:36:12 2025 +0900
Fix MyPy type errors in test_dags.py (#56735) (#56770)
* Fix MyPy type errors in test_dags.py
* Replace datetime with pendulum for UTC timezone handling in test_dags.py
---
airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_dags.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git
a/airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_dags.py
b/airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_dags.py
index d27cd3fb08d..6160a2b4817 100644
--- a/airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_dags.py
+++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_dags.py
@@ -16,7 +16,6 @@
# under the License.
from __future__ import annotations
-from datetime import datetime, timezone
from typing import TYPE_CHECKING
from unittest import mock
@@ -56,7 +55,7 @@ class TestGetDagRuns(TestPublicDagEndpoint):
for dag_id in [DAG1_ID, DAG2_ID, DAG3_ID, DAG4_ID, DAG5_ID]:
dag_runs_count = 5 if dag_id in [DAG1_ID, DAG2_ID] else 2
for i in range(dag_runs_count):
- start_date = datetime(2021 + i, 1, 1, 0, 0, 0,
tzinfo=timezone.utc)
+ start_date = pendulum.datetime(2021 + i, 1, 1, 0, 0, 0,
tz="UTC")
dag_run = DagRun(
dag_id=dag_id,
run_id=f"run_id_{i + 1}",
@@ -67,7 +66,8 @@ class TestGetDagRuns(TestPublicDagEndpoint):
state=(DagRunState.FAILED if i % 2 == 0 else
DagRunState.SUCCESS),
triggered_by=DagRunTriggeredByType.TEST,
)
- dag_run.end_date = dag_run.start_date +
pendulum.duration(hours=1)
+ if dag_run.start_date is not None:
+ dag_run.end_date = dag_run.start_date.add(hours=1)
session.add(dag_run)
session.commit()