From 3d26f48a6d4f68603d0870265d250e24000859e6 Mon Sep 17 00:00:00 2001 From: Shahar Epstein <60007259+shahar1@users.noreply.github.com> Date: Thu, 2 Jul 2026 15:41:46 +0300 Subject: [PATCH] Remove duplicate tests in Task SDK related: #68502 These tests are exact or near-exact duplicates of sibling tests that already assert the same behavior, so they add maintenance cost without adding coverage: - test_mask_secret_with_list / test_mask_secret_with_iterable duplicate each other and are subsumed by the parametrized test_mask_secret_with_objects. - test_build_task_group_with_prefix_functionality duplicates test_build_task_group_with_prefix. - test_override_dag_default_args is byte-identical to test_default_args. Tests that guard against a library or attrs-generated behavior change (equality, hashing, repr, exception-hierarchy catches, attribute round-trips) are kept, per review feedback. Generated-by: Claude Code (Opus 4.8) --- .../task_sdk/definitions/test_taskgroup.py | 52 ------------------- .../task_sdk/execution_time/test_comms.py | 10 ---- 2 files changed, 62 deletions(-) diff --git a/task-sdk/tests/task_sdk/definitions/test_taskgroup.py b/task-sdk/tests/task_sdk/definitions/test_taskgroup.py index d11f8eb3632b3..485346d6d28a8 100644 --- a/task-sdk/tests/task_sdk/definitions/test_taskgroup.py +++ b/task-sdk/tests/task_sdk/definitions/test_taskgroup.py @@ -272,40 +272,6 @@ def test_taskgroup_getitem_returns_child_by_label(prefix: bool): group1["nonexistent"] -def test_build_task_group_with_prefix_functionality(): - """ - Tests TaskGroup prefix_group_id functionality - additional test for comprehensive coverage. - """ - logical_date = pendulum.parse("20200101") - with DAG("test_prefix_functionality", start_date=logical_date): - task1 = EmptyOperator(task_id="task1") - with TaskGroup("group234", prefix_group_id=False) as group234: - task2 = EmptyOperator(task_id="task2") - - with TaskGroup("group34") as group34: - task3 = EmptyOperator(task_id="task3") - - with TaskGroup("group4", prefix_group_id=False) as group4: - task4 = EmptyOperator(task_id="task4") - - task5 = EmptyOperator(task_id="task5") - task1 >> group234 - group34 >> task5 - - # Test prefix_group_id behavior - assert task2.task_id == "task2" # prefix_group_id=False, so no prefix - assert group34.group_id == "group34" # nested group gets prefixed - assert task3.task_id == "group34.task3" # task in nested group gets full prefix - assert group4.group_id == "group34.group4" # nested group gets parent prefix - assert task4.task_id == "task4" # prefix_group_id=False, so no prefix - assert task5.task_id == "task5" # root level task, no prefix - - # Test group hierarchy and child access - assert group234.get_child_by_label("task2") == task2 - assert group234.get_child_by_label("group34") == group34 - assert group4.get_child_by_label("task4") == task4 - - def test_build_task_group_with_task_decorator(): """ Test that TaskGroup can be used with the @task decorator. @@ -579,24 +545,6 @@ def test_iter_tasks(): ] -def test_override_dag_default_args(): - logical_date = pendulum.parse("20201109") - with DAG( - dag_id="example_task_group_default_args", - schedule=None, - start_date=logical_date, - default_args={"owner": "dag"}, - ): - with TaskGroup("group1", default_args={"owner": "group"}): - task_1 = EmptyOperator(task_id="task_1") - task_2 = EmptyOperator(task_id="task_2", owner="task") - task_3 = EmptyOperator(task_id="task_3", default_args={"owner": "task"}) - - assert task_1.owner == "group" - assert task_2.owner == "task" - assert task_3.owner == "task" - - def test_override_dag_default_args_in_nested_tg(): logical_date = pendulum.parse("20201109") with DAG( diff --git a/task-sdk/tests/task_sdk/execution_time/test_comms.py b/task-sdk/tests/task_sdk/execution_time/test_comms.py index 51782796b825b..2463487e4c38d 100644 --- a/task-sdk/tests/task_sdk/execution_time/test_comms.py +++ b/task-sdk/tests/task_sdk/execution_time/test_comms.py @@ -60,16 +60,6 @@ def test_mask_secret_with_objects(self, object_to_mask): mask_secret_object = MaskSecret(value=object_to_mask, name="test_secret") assert mask_secret_object.value == object_to_mask - def test_mask_secret_with_list(self): - example_dict = ["test"] - mask_secret_object = MaskSecret(value=example_dict, name="test_secret") - assert mask_secret_object.value == example_dict - - def test_mask_secret_with_iterable(self): - example_dict = ["test"] - mask_secret_object = MaskSecret(value=example_dict, name="test_secret") - assert mask_secret_object.value == example_dict - class TestCommsDecoder: """Test the communication between the subprocess and the "supervisor"."""