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

add empty to context flags #10315

Merged
merged 2 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions .changes/unreleased/Features-20240617-103948.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Features
body: add --empty value to jinja context as flags.EMPTY
time: 2024-06-17T10:39:48.275801-04:00
custom:
Author: michelleark
Issue: "10317"
1 change: 1 addition & 0 deletions core/dbt/flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def get_flag_dict():
"target_path",
"log_path",
"invocation_command",
"empty",
}
return {key: getattr(GLOBAL_FLAGS, key.upper(), None) for key in flag_attr}

Expand Down
31 changes: 31 additions & 0 deletions tests/unit/context/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,34 @@ def test_log_with_dbt_env_secret(self):
BaseContext.log({"fact1": "I like cats"}, info=True)
except Exception as e:
assert False, f"Logging while a `DBT_ENV_SECRET` was set raised an exception: {e}"

def test_flags(self):
expected_context_flags = {
"use_experimental_parser",
"static_parser",
"warn_error",
"warn_error_options",
"write_json",
"partial_parse",
"use_colors",
"profiles_dir",
"debug",
"log_format",
"version_check",
"fail_fast",
"send_anonymous_usage_stats",
"printer_width",
"indirect_selection",
"log_cache_events",
"quiet",
"no_print",
"cache_selected_only",
"introspect",
"target_path",
"log_path",
"invocation_command",
"empty",
}
flags = BaseContext(cli_vars={}).flags
for expected_flag in expected_context_flags:
assert hasattr(flags, expected_flag.upper())
Loading