Skip to content

Commit c1dbce3

Browse files
committed
Add tests for enhancing missing coverage on exceptions
1 parent 5daf65e commit c1dbce3

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

tests/test_tasks_and_task_groups_list.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,23 @@ def test_build_with_duplicate_group_name_raises_exception():
178178
td = DagBuilder("dag_task_groups_list_dup", dag_config, DEFAULT_CONFIG_MINIMAL)
179179
with pytest.raises(DagFactoryConfigException, match="Duplicate group_name"):
180180
td.build()
181+
182+
183+
def test_missing_task_id_raises_exception():
184+
dag_config = _make_tasks_list_config()
185+
# Remove task_id from one of the task definitions
186+
dag_config["tasks"][0].pop("task_id")
187+
188+
td = DagBuilder("dag_missing_task_id", dag_config, DEFAULT_CONFIG_MINIMAL)
189+
with pytest.raises(DagFactoryConfigException, match="task_id"):
190+
td.build()
191+
192+
193+
def test_missing_task_group_name_raises_exception():
194+
dag_config = _make_task_groups_list_config()
195+
# Remove group_id from first task_group entry
196+
dag_config["task_groups"][0].pop("group_name")
197+
198+
td = DagBuilder("dag_missing_task_group_name", dag_config, DEFAULT_CONFIG_MINIMAL)
199+
with pytest.raises(DagFactoryConfigException, match="group_name"):
200+
td.build()

0 commit comments

Comments
 (0)