From 52a1766a21f2557d1a58d623df00c9992e7c2b50 Mon Sep 17 00:00:00 2001 From: Quigley Malcolm Date: Thu, 20 Jul 2023 16:10:08 -0700 Subject: [PATCH 1/3] Add test ensuring `warn_error_options` is dictified in `invocation_args_dict` of contexts --- test/unit/test_context.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/unit/test_context.py b/test/unit/test_context.py index 1c02a650b9a..cb77b56bd0c 100644 --- a/test/unit/test_context.py +++ b/test/unit/test_context.py @@ -423,6 +423,9 @@ def test_invocation_args_to_dict_in_macro_runtime_context( # Comes from unit/utils.py config_from_parts_or_dicts method assert ctx["invocation_args_dict"]["profile_dir"] == "/dev/null" + assert isinstance(ctx["invocation_args_dict"]["warn_error_options"], Dict) + assert ctx["invocation_args_dict"]["warn_error_options"] == {"include": [], "exclude": []} + def test_model_parse_context(config_postgres, manifest_fx, get_adapter, get_include_paths): ctx = providers.generate_parser_model_context( From d8676d95d6963b01d94db69e66983f7350737d83 Mon Sep 17 00:00:00 2001 From: Quigley Malcolm Date: Thu, 20 Jul 2023 16:13:08 -0700 Subject: [PATCH 2/3] Add dictification specific to `warn_error_options` in `args_to_dict` --- core/dbt/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/dbt/utils.py b/core/dbt/utils.py index c684e13fd17..ffd3f9ae6d4 100644 --- a/core/dbt/utils.py +++ b/core/dbt/utils.py @@ -17,6 +17,7 @@ from contextlib import contextmanager from dbt.events.types import RetryExternalCall, RecordRetryException +from dbt.helper_types import WarnErrorOptions from dbt import flags from enum import Enum from typing_extensions import Protocol @@ -654,6 +655,9 @@ def args_to_dict(args): # this was required for a test case if isinstance(var_args[key], PosixPath) or isinstance(var_args[key], WindowsPath): var_args[key] = str(var_args[key]) + if isinstance(var_args[key], WarnErrorOptions): + var_args[key] = var_args[key].to_dict() + dict_args[key] = var_args[key] return dict_args From 45271e11ec23aa51c9b6639194869408ebd2e012 Mon Sep 17 00:00:00 2001 From: Quigley Malcolm Date: Thu, 20 Jul 2023 16:15:43 -0700 Subject: [PATCH 3/3] Changie doc for serialization changes of warn_error_options --- .changes/unreleased/Fixes-20230720-161513.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/unreleased/Fixes-20230720-161513.yaml diff --git a/.changes/unreleased/Fixes-20230720-161513.yaml b/.changes/unreleased/Fixes-20230720-161513.yaml new file mode 100644 index 00000000000..9dd9c291cf3 --- /dev/null +++ b/.changes/unreleased/Fixes-20230720-161513.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Ensure `warn_error_options` get serialized in `invocation_args_dict` +time: 2023-07-20T16:15:13.761813-07:00 +custom: + Author: QMalcolm + Issue: "7694"