Skip to content

Commit

Permalink
Rename tests: singular + generic (#3880)
Browse files Browse the repository at this point in the history
* Fix #3347

* Rename data->singular, schema->generic

* Rm schema, data flag + tag behavior

* Update test FQNs, compiled paths

* Add changelog entry

automatic commit by git-black, original commits:
  ca7c1fc
  • Loading branch information
jtcohen6 authored and iknox-fa committed Feb 8, 2022
1 parent f841f03 commit b76bbca
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion core/dbt/clients/jinja.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ def extract_toplevel_blocks(
)


GENERIC_TEST_KWARGS_NAME = '_dbt_generic_test_kwargs'
GENERIC_TEST_KWARGS_NAME = "_dbt_generic_test_kwargs"


def add_rendered_test_kwargs(
Expand Down
7 changes: 3 additions & 4 deletions core/dbt/graph/selector_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,14 +405,13 @@ def search(
) -> Iterator[UniqueId]:
search_types: Tuple[Type, ...]
# continue supporting 'schema' + 'data' for backwards compatibility
if selector in ('generic', 'schema'):
if selector in ("generic", "schema"):
search_types = (ParsedGenericTestNode, CompiledGenericTestNode)
elif selector in ('singular', 'data'):
elif selector in ("singular", "data"):
search_types = (ParsedSingularTestNode, CompiledSingularTestNode)
else:
raise RuntimeException(
f'Invalid test type selector {selector}: expected "generic" or '
'"singular"'
f'Invalid test type selector {selector}: expected "generic" or ' '"singular"'
)

for node, real_node in self.parsed_nodes(included_nodes):
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/parser/generic_test_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def from_test_block(
test: Dict[str, Any],
column_name: Optional[str],
tags: List[str],
) -> 'GenericTestBlock':
) -> "GenericTestBlock":
return cls(
file=src.file,
data=src.data,
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/parser/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def load(self):

# Load the rest of the files except for schema yaml files
parser_types: List[Type[Parser]] = [
ModelParser, SnapshotParser, AnalysisParser, SingularTestParser,
ModelParser,
SeedParser, DocumentationParser, HookParser]
for project in self.all_projects.values():
if project.project_name not in project_parser_files:
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/parser/read_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def read_files(project, files, parser_files, saved_files):
project, files, project.analysis_paths, '.sql', ParseFileType.Analysis, saved_files
)

project_files['SingularTestParser'] = read_files_for_parser(
project_files["SingularTestParser"] = read_files_for_parser(
project, files, project.test_paths, '.sql', ParseFileType.SingularTest, saved_files
)

Expand Down
6 changes: 4 additions & 2 deletions core/dbt/parser/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
from dbt.parser.base import SimpleParser
from dbt.parser.search import FileBlock
from dbt.parser.generic_test_builders import (
TestBuilder, GenericTestBlock, TargetBlock, YamlBlock,
TestBuilder,
TestBlock, Testable
)
from dbt.ui import warning_tag
Expand Down Expand Up @@ -439,7 +439,9 @@ def add_test_node(self, block: GenericTestBlock, node: ParsedGenericTestNode):
self.manifest.add_disabled(block.file, node, test_from)

def render_with_context(
self, node: ParsedGenericTestNode, config: ContextConfig,
self,
node: ParsedGenericTestNode,
config: ContextConfig,
) -> None:
"""Given the parsed node and a ContextConfig to use during
parsing, collect all the refs that might be squirreled away in the test
Expand Down

0 comments on commit b76bbca

Please sign in to comment.