diff --git a/.changes/unreleased/Under the Hood-20240916-102201.yaml b/.changes/unreleased/Under the Hood-20240916-102201.yaml new file mode 100644 index 00000000000..48485d44f48 --- /dev/null +++ b/.changes/unreleased/Under the Hood-20240916-102201.yaml @@ -0,0 +1,6 @@ +kind: Under the Hood +body: Replace `TestSelector` with `ResourceTypeSelector` +time: 2024-09-16T10:22:01.339462-06:00 +custom: + Author: dbeatty10 + Issue: "10718" diff --git a/core/dbt/task/build.py b/core/dbt/task/build.py index 62d2ed28c7c..832f7f0fe47 100644 --- a/core/dbt/task/build.py +++ b/core/dbt/task/build.py @@ -11,7 +11,6 @@ from dbt.graph import Graph, GraphQueue, ResourceTypeSelector from dbt.node_types import NodeType from dbt.task.base import BaseRunner, resource_types_from_args -from dbt.task.test import TestSelector from dbt_common.events.functions import fire_event from .run import ModelRunner as run_model_runner @@ -198,7 +197,7 @@ def get_node_selector(self, no_unit_tests=False) -> ResourceTypeSelector: resource_types = self.resource_types(no_unit_tests) if resource_types == [NodeType.Test]: - return TestSelector( + return ResourceTypeSelector( graph=self.graph, manifest=self.manifest, previous_state=self.previous_state, diff --git a/core/dbt/task/list.py b/core/dbt/task/list.py index 53fc0d80a13..180cfc71693 100644 --- a/core/dbt/task/list.py +++ b/core/dbt/task/list.py @@ -17,7 +17,6 @@ from dbt.node_types import NodeType from dbt.task.base import resource_types_from_args from dbt.task.runnable import GraphRunnableTask -from dbt.task.test import TestSelector from dbt_common.events.contextvars import task_contextvars from dbt_common.events.functions import fire_event, warn_or_error from dbt_common.events.types import PrintEvent @@ -201,7 +200,7 @@ def get_node_selector(self): if self.manifest is None or self.graph is None: raise DbtInternalError("manifest and graph must be set to get perform node selection") if self.resource_types == [NodeType.Test]: - return TestSelector( + return ResourceTypeSelector( graph=self.graph, manifest=self.manifest, previous_state=self.previous_state, diff --git a/core/dbt/task/test.py b/core/dbt/task/test.py index f8b6b5964d7..05320bcf38f 100644 --- a/core/dbt/task/test.py +++ b/core/dbt/task/test.py @@ -375,18 +375,6 @@ def _render_daff_diff(self, daff_diff: daff.TableDiff) -> str: return rendered -class TestSelector(ResourceTypeSelector): - def __init__( - self, graph, manifest, previous_state, resource_types=[NodeType.Test, NodeType.Unit] - ) -> None: - super().__init__( - graph=graph, - manifest=manifest, - previous_state=previous_state, - resource_types=resource_types, - ) - - class TestTask(RunTask): """ Testing: @@ -399,13 +387,14 @@ class TestTask(RunTask): def raise_on_first_error(self) -> bool: return False - def get_node_selector(self) -> TestSelector: + def get_node_selector(self) -> ResourceTypeSelector: if self.manifest is None or self.graph is None: raise DbtInternalError("manifest and graph must be set to get perform node selection") - return TestSelector( + return ResourceTypeSelector( graph=self.graph, manifest=self.manifest, previous_state=self.previous_state, + resource_types=[NodeType.Test, NodeType.Unit], ) def get_runner_type(self, _) -> Optional[Type[BaseRunner]]: