Skip to content

Commit 8431e42

Browse files
committed
check test node enabled status during final parsing phase
1 parent 8ded115 commit 8431e42

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

core/dbt/parser/unit_tests.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@ def parse(self) -> ParseResult:
290290
)
291291

292292
if tested_model_node:
293+
print(tested_model_node.name)
294+
print(tested_model_node.config.enabled)
295+
print("--------------------------------")
293296
if tested_model_node.config.enabled:
294297
unit_test_definition.depends_on.nodes.append(tested_model_node.unique_id)
295298
unit_test_definition.schema = tested_model_node.schema
@@ -519,8 +522,11 @@ def process_models_for_unit_test(
519522
f"Unable to find model '{current_project}.{unit_test_def.model}' for "
520523
f"unit test '{unit_test_def.name}' in {unit_test_def.original_file_path}"
521524
)
522-
unit_test_def.depends_on.nodes.append(tested_node.unique_id)
523-
unit_test_def.schema = tested_node.schema
525+
if tested_node.config.enabled:
526+
unit_test_def.depends_on.nodes.append(tested_node.unique_id)
527+
unit_test_def.schema = tested_node.schema
528+
else:
529+
unit_test_def.config.enabled = False
524530

525531
# The UnitTestDefinition should only have one "depends_on" at this point,
526532
# the one that's found by the "model" field.

0 commit comments

Comments
 (0)