henry3260 commented on code in PR #66488:
URL: https://github.com/apache/airflow/pull/66488#discussion_r3213259113


##########
airflow-core/tests/unit/dag_processing/test_collection.py:
##########
@@ -101,31 +102,59 @@ def test_statement_latest_runs_one_dag():
 
 
 @pytest.mark.db_test
-def test_statement_latest_runs_partitioned_sorted_by_partition_date(dag_maker, 
session):
-    with dag_maker("fake-dag", schedule=None):
-        pass
-    dag_maker.sync_dagbag_to_db()
+def test_statement_latest_runs_loads_timetable_fields(session):
+    logical_date = tz.datetime(2025, 1, 1)
+    run_after = tz.datetime(2025, 1, 2)
+
+    session.add(
+        DagRun(
+            dag_id="fake-dag",
+            run_id="latest-run",
+            logical_date=logical_date,
+            data_interval=(logical_date, run_after),
+            run_type=DagRunType.SCHEDULED,
+            run_after=run_after,
+        )
+    )
+    session.flush()
+
+    latest = session.scalar(_get_latest_runs_stmt("fake-dag"))
+    assert latest is not None
+    assert {"run_after", "partition_date", 
"partition_key"}.isdisjoint(sa_inspect(latest).unloaded)
+    assert latest.run_after == run_after
+    assert latest.partition_key is None
+    assert latest.partition_date is None
+
 
[email protected]_test
+def test_statement_latest_runs_partitioned_sorted_by_partition_date(session):
     for i, (run_id, partition_key, partition_date) in enumerate(
         (
             ("newest-partition-date", "2025-01-02", tz.datetime(2025, 1, 2)),
             ("older-partition-date", "2025-01-01", tz.datetime(2025, 1, 1)),
             ("null-partition-date", "not-a-time-based-partition", None),
         )
     ):
-        dag_maker.create_dagrun(

Review Comment:
   > May I ask why do we need to change the existing test case here?
   
   Ah, my apologies!



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to