Skip to content

Commit

Permalink
add __test__ = False to non-test classes that start with Test (#8086)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichelleArk authored Jul 13, 2023
1 parent 5310d37 commit be4d0a5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/dbt/contracts/graph/model_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ def validate(cls, data):

@dataclass
class TestConfig(NodeAndTestConfig):
__test__ = False

# this is repeated because of a different default
schema: Optional[str] = field(
default="dbt_test__audit",
Expand Down
2 changes: 2 additions & 0 deletions core/dbt/contracts/graph/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,8 @@ def test_node_type(self):

@dataclass
class TestMetadata(dbtClassMixin, Replaceable):
__test__ = False

name: str
# kwargs are the args that are left in the test builder after
# removing configs. They are set from the test builder when
Expand Down
4 changes: 4 additions & 0 deletions core/dbt/graph/selector_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,8 @@ def search(self, included_nodes: Set[UniqueId], selector: str) -> Iterator[Uniqu


class TestNameSelectorMethod(SelectorMethod):
__test__ = False

def search(self, included_nodes: Set[UniqueId], selector: str) -> Iterator[UniqueId]:
for node, real_node in self.parsed_nodes(included_nodes):
if real_node.resource_type == NodeType.Test and hasattr(real_node, "test_metadata"):
Expand All @@ -445,6 +447,8 @@ def search(self, included_nodes: Set[UniqueId], selector: str) -> Iterator[Uniqu


class TestTypeSelectorMethod(SelectorMethod):
__test__ = False

def search(self, included_nodes: Set[UniqueId], selector: str) -> Iterator[UniqueId]:
search_type: Type
# continue supporting 'schema' + 'data' for backwards compatibility
Expand Down
2 changes: 2 additions & 0 deletions core/dbt/parser/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,8 @@ def patch_node_properties(self, node, patch: "ParsedNodePatch"):

# TestablePatchParser = seeds, snapshots
class TestablePatchParser(NodePatchParser[UnparsedNodeUpdate]):
__test__ = False

def get_block(self, node: UnparsedNodeUpdate) -> TestBlock:
return TestBlock.from_yaml_block(self.yaml, node)

Expand Down

0 comments on commit be4d0a5

Please sign in to comment.