ephraimbuddy commented on code in PR #23731:
URL: https://github.com/apache/airflow/pull/23731#discussion_r888897153


##########
tests/jobs/test_scheduler_job.py:
##########
@@ -4099,42 +4099,44 @@ def test_catchup_works_correctly(self, dag_maker):
         ) > (timezone.utcnow() - timedelta(days=2))
 
 
[email protected](reason="Work out where this goes")
-def test_task_with_upstream_skip_process_task_instances():
+# @pytest.mark.xfail(reason="Work out where this goes")

Review Comment:
   ```suggestion
   ```



##########
tests/jobs/test_scheduler_job.py:
##########
@@ -4099,42 +4099,44 @@ def test_catchup_works_correctly(self, dag_maker):
         ) > (timezone.utcnow() - timedelta(days=2))
 
 
[email protected](reason="Work out where this goes")
-def test_task_with_upstream_skip_process_task_instances():
+# @pytest.mark.xfail(reason="Work out where this goes")
[email protected]_serialized_dag
+def test_task_with_upstream_skip_process_task_instances(dag_maker, session):
     """
     Test if _process_task_instances puts a task instance into SKIPPED state if 
any of its
     upstream tasks are skipped according to TriggerRuleDep.
     """

Review Comment:
   I think both the test name and the doc string need to be changed



##########
tests/jobs/test_scheduler_job.py:
##########
@@ -4099,42 +4099,44 @@ def test_catchup_works_correctly(self, dag_maker):
         ) > (timezone.utcnow() - timedelta(days=2))
 
 
[email protected](reason="Work out where this goes")
-def test_task_with_upstream_skip_process_task_instances():
+# @pytest.mark.xfail(reason="Work out where this goes")
[email protected]_serialized_dag
+def test_task_with_upstream_skip_process_task_instances(dag_maker, session):
     """
     Test if _process_task_instances puts a task instance into SKIPPED state if 
any of its
     upstream tasks are skipped according to TriggerRuleDep.
     """
-    clear_db_runs()
-    with DAG(
-        dag_id='test_task_with_upstream_skip_dag', start_date=DEFAULT_DATE, 
schedule_interval=None
-    ) as dag:
+    with dag_maker(
+        dag_id='test_task_with_upstream_skip_process_task_instances',
+        start_date=DEFAULT_DATE,
+        session=session,
+    ):
         dummy1 = EmptyOperator(task_id='dummy1')
         dummy2 = EmptyOperator(task_id="dummy2")
         dummy3 = EmptyOperator(task_id="dummy3")
         [dummy1, dummy2] >> dummy3
-
     # dag_file_processor = DagFileProcessor(dag_ids=[], log=mock.MagicMock())
-    dag.clear()
-    dr = dag.create_dagrun(run_type=DagRunType.MANUAL, state=State.RUNNING, 
execution_date=DEFAULT_DATE)
+    dr = dag_maker.create_dagrun(state=State.RUNNING)
     assert dr is not None
 
-    with create_session() as session:
-        tis = {ti.task_id: ti for ti in dr.get_task_instances(session=session)}
-        # Set dummy1 to skipped and dummy2 to success. dummy3 remains as none.
-        tis[dummy1.task_id].state = State.SKIPPED
-        tis[dummy2.task_id].state = State.SUCCESS
-        assert tis[dummy3.task_id].state == State.NONE
+    tis = {ti.task_id: ti for ti in dr.get_task_instances(session=session)}
+    # Set dummy1 to skipped and dummy2 to success. dummy3 remains as none.
+    tis[dummy1.task_id].state = State.SKIPPED
+    tis[dummy2.task_id].state = State.SUCCESS
+    assert tis[dummy3.task_id].state == State.NONE
+    session.flush()
+    # dr.refresh_from_db(session=session)

Review Comment:
   ```suggestion
   ```



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