Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix post_model_hook call in data and unit tests #10809

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions core/dbt/task/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,15 @@
"Invalid materialization context generated, missing config: {}".format(context)
)

context_config = context["config"]

Check warning on line 162 in core/dbt/task/test.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/test.py#L162

Added line #L162 was not covered by tests

# 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)

Check warning on line 170 in core/dbt/task/test.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/test.py#L170

Added line #L170 was not covered by tests

# load results from context
# could eventually be returned directly by materialization
Expand Down Expand Up @@ -238,6 +240,8 @@
"Invalid materialization context generated, missing config: {}".format(context)
)

context_config = context["config"]

Check warning on line 243 in core/dbt/task/test.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/test.py#L243

Added line #L243 was not covered by tests

# generate materialization macro
macro_func = MacroGenerator(materialization_macro, context)
try:
Expand All @@ -249,7 +253,7 @@
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)

Check warning on line 256 in core/dbt/task/test.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/test.py#L256

Added line #L256 was not covered by tests

# load results from context
# could eventually be returned directly by materialization
Expand Down
Loading