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

test macro: set model_node_being_tested before caller() instead of after #218

Merged
merged 1 commit into from
Jul 23, 2024
Merged
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
2 changes: 1 addition & 1 deletion macros/tests.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
{% if execute %}
{% if flags.WHICH in ('test', 'build') %}
{{ dbt_unit_testing.set_test_context("is_incremental_should_be_true_for_this_model", "") }}
{% set mocks_and_expectations_json_str = caller() %}
{% set model_version = kwargs["version"] | default(kwargs["v"]) | default(none) %}
{% set model_node = {"package_name": model.package_name, "name": model_name, "version": model_version} %}
{{ dbt_unit_testing.set_test_context("model_node_being_tested", model_node) }}
{% set mocks_and_expectations_json_str = caller() %}
{% set test_configuration, test_queries = dbt_unit_testing.build_configuration_and_test_queries(model_node, test_description, options, mocks_and_expectations_json_str) %}
{% set test_report = dbt_unit_testing.build_test_report(test_configuration, test_queries) %}

Expand Down
Loading