Skip to content

Commit

Permalink
Play with test_metadata.kwargs
Browse files Browse the repository at this point in the history
  • Loading branch information
jtcohen6 committed May 14, 2022
1 parent 85db3bd commit f0dc98a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions core/dbt/clients/jinja.py
Expand Up @@ -630,5 +630,7 @@ def _convert_function(value: Any, keypath: Tuple[Union[str, int], ...]) -> Any:

# The test_metadata.kwargs come from the test builder, and were set
# when the test node was created in _parse_generic_test.
# Overwrite them with the rendered versions during test compilation
kwargs = deep_map_render(_convert_function, node.test_metadata.kwargs)
node.test_metadata.kwargs = kwargs
context[GENERIC_TEST_KWARGS_NAME] = kwargs
Expand Up @@ -3,7 +3,7 @@
{%- endmacro %}

{% macro default__get_test_sql(main_sql, fail_calc, warn_if, error_if, limit) -%}
{% set model_name = model.file_key_name.split('.')[1] %}
{% set model_name = model.test_metadata.kwargs.model %}
{% set warn_if, warn_pct_division = get_pct_division(warn_if, model_name) %}
{% set error_if, error_pct_division = get_pct_division(error_if, model_name) %}

Expand Down

0 comments on commit f0dc98a

Please sign in to comment.