Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@ def test_defaults(self):
assert ac.consumer_teams is None
assert ac.allow_global is True

def test_explicit_values(self):
ac = AssetAccessControl(
producer_teams=["team_a", "team_b"],
consumer_teams=["team_c"],
allow_global=False,
)
assert ac.producer_teams == ["team_a", "team_b"]
assert ac.consumer_teams == ["team_c"]
assert ac.allow_global is False

@pytest.mark.parametrize(
"teams",
[
Expand Down
5 changes: 0 additions & 5 deletions task-sdk/tests/task_sdk/definitions/test_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,8 +990,3 @@ def test_getitem_missing_raises_node_not_found(self):
dag = DAG("test_dag", schedule=None, start_date=DEFAULT_DATE)
with pytest.raises(NodeNotFound):
dag["nonexistent"]

def test_getitem_missing_is_key_error(self):
dag = DAG("test_dag", schedule=None, start_date=DEFAULT_DATE)
with pytest.raises(KeyError):
dag["nonexistent"]
63 changes: 0 additions & 63 deletions task-sdk/tests/task_sdk/definitions/test_taskgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -970,17 +918,6 @@ def test_getitem_missing_raises_node_not_found(self):
with pytest.raises(NodeNotFound):
tg["nonexistent"]

def test_getitem_missing_is_key_error(self):
import pendulum

start = pendulum.datetime(2016, 1, 1)
with DAG("test_dag", schedule=None, start_date=start):
with TaskGroup(group_id="section") as tg:
pass

with pytest.raises(KeyError):
tg["nonexistent"]


# --- topological_sort: cross-shape correctness ---
#
Expand Down
21 changes: 0 additions & 21 deletions task-sdk/tests/task_sdk/definitions/test_wait_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,14 @@


class TestSdkWaitForAll:
def test_repr(self):
assert repr(WaitForAll()) == "WaitForAll()"

def test_eq(self):
assert WaitForAll() == WaitForAll()

def test_neq_other_policy(self):
assert WaitForAll() != MinimumCount(1)

def test_hash_consistent(self):
assert hash(WaitForAll()) == hash(WaitForAll())


class TestSdkMinimumCount:
def test_stores_n(self):
assert MinimumCount(5).n == 5

def test_eq_same_n(self):
assert MinimumCount(5) == MinimumCount(5)

def test_neq_different_n(self):
assert MinimumCount(5) != MinimumCount(6)

def test_repr(self):
assert repr(MinimumCount(5)) == "MinimumCount(n=5)"

def test_hash_consistent(self):
assert hash(MinimumCount(5)) == hash(MinimumCount(5))

def test_zero_rejected(self):
with pytest.raises(ValueError, match="MinimumCount\\(0\\) is degenerate"):
MinimumCount(0)
10 changes: 0 additions & 10 deletions task-sdk/tests/task_sdk/execution_time/test_comms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"."""
Expand Down
12 changes: 0 additions & 12 deletions task-sdk/tests/task_sdk/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
# under the License.
from __future__ import annotations

import pytest

from airflow.sdk.exceptions import NodeNotFound, TaskNotFound


Expand All @@ -29,15 +27,5 @@ def test_node_not_found_is_subclass_of_key_error():
assert issubclass(NodeNotFound, KeyError)


def test_node_not_found_caught_as_key_error():
with pytest.raises(KeyError):
raise NodeNotFound("missing_task")


def test_node_not_found_caught_as_task_not_found():
with pytest.raises(TaskNotFound):
raise NodeNotFound("missing_task")


def test_node_not_found_str_suppresses_key_error_repr():
assert str(NodeNotFound("missing")) == "missing"
Loading