You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/05/15 11:41:23 UTC
[GitHub] [airflow] zhongjiajie commented on a change in pull request #8828: Check for same task instead of Equality to detect Duplicate Tasks
zhongjiajie commented on a change in pull request #8828:
URL: https://github.com/apache/airflow/pull/8828#discussion_r425743881
##########
File path: tests/models/test_dag.py
##########
@@ -979,34 +979,18 @@ def test_duplicate_task_ids_not_allowed_with_dag_context_manager(self):
self.assertEqual(dag.task_dict, {op1.task_id: op1})
- # Also verify that DAGs with duplicate task_ids don't raise errors
- with DAG("test_dag_1", start_date=DEFAULT_DATE) as dag1:
- op3 = DummyOperator(task_id="t3")
- op4 = BashOperator(task_id="t4", bash_command="sleep 1")
- op3 >> op4
-
- self.assertEqual(dag1.task_dict, {op3.task_id: op3, op4.task_id: op4})
-
def test_duplicate_task_ids_not_allowed_without_dag_context_manager(self):
"""Verify tasks with Duplicate task_id raises error"""
with self.assertRaisesRegex(
DuplicateTaskIdFound, "Task id 't1' has already been added to the DAG"
):
dag = DAG("test_dag", start_date=DEFAULT_DATE)
op1 = DummyOperator(task_id="t1", dag=dag)
- op2 = BashOperator(task_id="t1", bash_command="sleep 1", dag=dag)
+ op2 = DummyOperator(task_id="t1", dag=dag)
Review comment:
Should we add one more test with diff operator type but same task_id here? to cover all types test/ edge case
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org