From 16562c6f0cb4435de9fc65ad11a1096c571b6dce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Tue, 1 Oct 2024 23:33:15 -0600 Subject: [PATCH] Fix `post_model_hook` in data and unit tests --- core/dbt/task/test.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/dbt/task/test.py b/core/dbt/task/test.py index 6580b85879b..4c614399a49 100644 --- a/core/dbt/task/test.py +++ b/core/dbt/task/test.py @@ -159,13 +159,15 @@ def execute_data_test(self, data_test: TestNode, manifest: Manifest) -> TestResu "Invalid materialization context generated, missing config: {}".format(context) ) + context_config = context["config"] + # generate materialization macro macro_func = MacroGenerator(materialization_macro, context) try: # execute materialization macro macro_func() finally: - self.adapter.post_model_hook(context, hook_ctx) + self.adapter.post_model_hook(context_config, hook_ctx) # load results from context # could eventually be returned directly by materialization @@ -238,6 +240,8 @@ def execute_unit_test( "Invalid materialization context generated, missing config: {}".format(context) ) + context_config = context["config"] + # generate materialization macro macro_func = MacroGenerator(materialization_macro, context) try: @@ -249,7 +253,7 @@ def execute_unit_test( f"There may be an error in the unit test definition: check the data types.\n {e}" ) finally: - self.adapter.post_model_hook(context, hook_ctx) + self.adapter.post_model_hook(context_config, hook_ctx) # load results from context # could eventually be returned directly by materialization