sejal-gupta-ksolves commented on code in PR #68837:
URL: https://github.com/apache/airflow/pull/68837#discussion_r3726106467


##########
task-sdk/tests/task_sdk/definitions/test_dag.py:
##########
@@ -490,6 +491,39 @@ def execute(self, context):
         with pytest.raises(FailFastDagInvalidTriggerRule):
             fail_fast_dag.add_task(task_with_non_default_trigger_rule)
 
+    def test_dag_test_runtime_start_date_decoupled_from_logical_date(self, 
time_machine):
+        """
+        Ensure DAG.test decouples its execution start_date from historical 
logical_dates
+        by isolating the runtime creation point from background metadata 
dependencies.
+        """
+        # 1. Setup anchor dates using Pendulum
+        past_logical_date = pendulum.datetime(2024, 1, 1, tz="UTC")
+        frozen_now = pendulum.datetime(2026, 6, 22, 12, 0, 0, tz="UTC")
+
+        time_machine.move_to(frozen_now, tick=False)
+
+        # 2. Instantiate minimal DAG context
+        with DAG(dag_id="test_runtime_duration_isolation", 
start_date=past_logical_date) as dag:
+            pass
+
+        # 3. Suppress all core metadata lookups by isolating the active 
execution scope
+        with (
+            mock.patch("airflow.models.dagrun.get_or_create_dagrun") as 
mock_create_run,

Review Comment:
   I've completely removed this mocked test from task-sdk and added an 
integration test test_dag_test_runtime_start_date_decoupled_from_logical_date 
under airflow-core/tests/unit/models/test_dag.py that runs against the DB and 
asserts dr.start_date directly.



-- 
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