From f6088db25b4a386db49dfda5de613d1e70bb2445 Mon Sep 17 00:00:00 2001 From: devmessias Date: Mon, 14 Oct 2024 17:09:19 -0300 Subject: [PATCH] doc: temp change to illustrate a point --- core/dbt/parser/unit_tests.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/dbt/parser/unit_tests.py b/core/dbt/parser/unit_tests.py index 0e60c90274b..a29045df6d7 100644 --- a/core/dbt/parser/unit_tests.py +++ b/core/dbt/parser/unit_tests.py @@ -104,6 +104,15 @@ def parse_unit_test_case(self, test_case: UnitTestDefinition): self.manifest, test_case.package_name, ) + + # just to illustrate the issue in #..., but this change is obviously not + # the correct solution. I’ll wait for a discussion before writing any more + # advanced code. + + if "var" not in ctx: + ctx["var"] = lambda var_name, default =None: default + if "env_var" not in ctx: + ctx["env_var"] = lambda var_name, default=None: default get_rendered(unit_test_node.raw_code, ctx, unit_test_node, capture_macros=True) # unit_test_node now has a populated refs/sources