You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "uranusjr (via GitHub)" <gi...@apache.org> on 2023/03/06 06:04:37 UTC

[GitHub] [airflow] uranusjr commented on a diff in pull request #29933: Explicit skipped states list for ExternalTaskSensor

uranusjr commented on code in PR #29933:
URL: https://github.com/apache/airflow/pull/29933#discussion_r1125957401


##########
tests/sensors/test_external_task_sensor.py:
##########
@@ -307,6 +307,27 @@ def test_external_task_sensor_soft_fail_failed_states_as_skipped(self):
         assert len(task_instances) == 1, "Unexpected number of task instances"
         assert task_instances[0].state == State.SKIPPED, "Unexpected external task state"
 
+    def test_external_task_sensor_skipped_states_as_skipped(self):
+        self.add_time_sensor()
+        op = ExternalTaskSensor(
+            task_id="test_external_task_sensor_check",
+            external_dag_id=TEST_DAG_ID,
+            external_task_id=TEST_TASK_ID,
+            allowed_states=[State.FAILED],
+            skipped_states=[State.SUCCESS],
+            dag=self.dag,
+        )
+
+        # when
+        op.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE, ignore_ti_state=True)
+
+        # then
+        session = settings.Session()

Review Comment:
   Use the `session` fixture instead please.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org