Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace TestSelector with ResourceTypeSelector #10718

Merged
merged 5 commits into from
Sep 18, 2024
Merged
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
6 changes: 6 additions & 0 deletions .changes/unreleased/Under the Hood-20240916-102201.yaml
Original file line number Diff line number Diff line change
@@ -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"
3 changes: 1 addition & 2 deletions core/dbt/task/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -198,7 +197,7 @@
resource_types = self.resource_types(no_unit_tests)

if resource_types == [NodeType.Test]:
return TestSelector(
return ResourceTypeSelector(

Check warning on line 200 in core/dbt/task/build.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/build.py#L200

Added line #L200 was not covered by tests
graph=self.graph,
manifest=self.manifest,
previous_state=self.previous_state,
Expand Down
3 changes: 1 addition & 2 deletions core/dbt/task/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -201,7 +200,7 @@
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(

Check warning on line 203 in core/dbt/task/list.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/list.py#L203

Added line #L203 was not covered by tests
graph=self.graph,
manifest=self.manifest,
previous_state=self.previous_state,
Expand Down
17 changes: 3 additions & 14 deletions core/dbt/task/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,18 +375,6 @@
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:
Expand All @@ -399,13 +387,14 @@
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(

Check warning on line 393 in core/dbt/task/test.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/test.py#L393

Added line #L393 was not covered by tests
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]]:
Expand Down
Loading