Skip to content

Commit 264b03d

Browse files
committed
Expect the TaskGroup cycle warning in the SDK topological sort test
The bridged TaskGroup in that test is now a deprecated cycle, so check_cycle warns there instead of passing silently, and its docstring no longer held. TriggerRule is already imported at module level for the mapped group test.
1 parent 9680477 commit 264b03d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎task-sdk/tests/task_sdk/definitions/test_dag.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,15 @@ def test_dag_topological_sort_dag_without_tasks(self):
8989
assert dag.topological_sort() == ()
9090

9191
def test_dag_topological_sort_task_group_cycle(self):
92-
"""A TaskGroup that depends on a sibling in a cycle, although check_cycle passes, still sorts."""
92+
"""A TaskGroup that depends on a sibling in a cycle, which check_cycle only warns about, still sorts."""
9393
with DAG("dag", schedule=None, start_date=DEFAULT_DATE) as dag:
9494
bridge = BaseOperator(task_id="bridge")
9595
with TaskGroup("group"):
9696
a = BaseOperator(task_id="a")
9797
b = BaseOperator(task_id="b")
9898
a >> bridge >> b
99-
dag.check_cycle()
99+
with pytest.warns(TaskGroupCycleDeprecationWarning):
100+
dag.check_cycle()
100101

101102
assert [task.task_id for task in dag.topological_sort()] == ["bridge", "group.a", "group.b"]
102103

@@ -479,7 +480,6 @@ def all_subclasses(cls):
479480

480481
def test_dag_add_task_checks_trigger_rule(self):
481482
# A non fail stop dag should allow any trigger rule
482-
from airflow.sdk import TriggerRule
483483
from airflow.sdk.exceptions import FailFastDagInvalidTriggerRule
484484

485485
class CustomOperator(BaseOperator):

0 commit comments

Comments
 (0)