SamWheating commented on a change in pull request #22410:
URL: https://github.com/apache/airflow/pull/22410#discussion_r836664974
##########
File path: tests/api/common/test_mark_tasks.py
##########
@@ -514,8 +514,13 @@ def test_set_running_dag_run_to_failed(self):
self._set_default_task_instance_states(dr)
altered = set_dag_run_state_to_failed(dag=self.dag1, run_id=dr.run_id,
commit=True)
- # Only running task should be altered.
- expected = self._get_num_tasks_with_starting_state(State.RUNNING,
inclusion=True)
+ # Only non-completed tasks should be altered.
+ expected = len(self.INITIAL_TASK_STATES.values()) -
self._get_num_tasks_with_starting_state(
+ State.SUCCESS, inclusion=True
+ )
+ expected = expected -
self._get_num_tasks_with_starting_state(State.FAILED, inclusion=True)
+ expected = expected -
self._get_num_tasks_with_starting_state(State.SKIPPED, inclusion=True)
+ expected = expected -
self._get_num_tasks_with_starting_state(State.UPSTREAM_FAILED, inclusion=True)
Review comment:
This piece of code is replicated three times - thoughts on splitting it
out into its own function?
--
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]