-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 test_builtin_invocation_args_dict_function #6898
Merged
iknox-fa
merged 7 commits into
feature/click-cli
from
jerco/fix-test_builtin_invocation_args_dict_function
Feb 9, 2023
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4954c49
Fix test_builtin_invocation_args_dict_function
jtcohen6 cb05818
Check a specific value, too
jtcohen6 3464ba7
Break the test, again, for now
jtcohen6 74dde44
fixed the issue in DO_NOT_TRACK code
iknox-fa ed81349
Merge branch 'jerco/fix-test_builtin_invocation_args_dict_function' o…
iknox-fa 7922969
Beefed up the tests to catch future clobbering
iknox-fa 255e715
cleaned up test a smidge
iknox-fa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,9 @@ | |
|
||
macros__validate_invocation_sql = """ | ||
{% macro validate_invocation(my_variable) %} | ||
-- check a specific value | ||
{{ log("use_colors: "~ invocation_args_dict['use_colors']) }} | ||
-- whole dictionary (as string) | ||
{{ log("invocation_result: "~ invocation_args_dict) }} | ||
{% endmacro %} | ||
""" | ||
|
@@ -61,7 +64,11 @@ def parse_json_logs(json_log_output): | |
|
||
def find_result_in_parsed_logs(parsed_logs, result_name): | ||
return next( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Can we rewrite this as a loop instead? |
||
(item for item in parsed_logs if result_name in item["info"].get("msg", "msg")), | ||
( | ||
item["data"]["msg"] | ||
for item in parsed_logs | ||
if result_name in item["data"].get("msg", "msg") | ||
), | ||
False, | ||
) | ||
|
||
|
@@ -104,27 +111,22 @@ def test_builtin_invocation_args_dict_function(self, project): | |
) | ||
|
||
parsed_logs = parse_json_logs(log_output) | ||
result = find_result_in_parsed_logs(parsed_logs, "invocation_result") | ||
|
||
use_colors = result = find_result_in_parsed_logs(parsed_logs, "use_colors") | ||
assert use_colors == "use_colors: True" | ||
invocation_dict = find_result_in_parsed_logs(parsed_logs, "invocation_result") | ||
assert result | ||
|
||
# Result is checked in two parts because profiles_dir is unique each test run | ||
expected = "invocation_result: {'debug': True, 'log_format': 'json', 'write_json': True, 'use_colors': True, 'printer_width': 80, 'version_check': True, 'partial_parse': True, 'static_parser': True, 'profiles_dir': " | ||
assert expected in str(result) | ||
iknox-fa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# The result should include a dictionary of all flags with values that aren't None | ||
expected = ( | ||
"'send_anonymous_usage_stats': False", | ||
iknox-fa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"'quiet': False", | ||
"'no_print': False", | ||
iknox-fa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"'print': True", | ||
"'cache_selected_only': False", | ||
"'macro': 'validate_invocation'", | ||
"'args': '{my_variable: test_variable}'", | ||
iknox-fa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"'args': {'my_variable': 'test_variable'}", | ||
"'which': 'run-operation'", | ||
"'rpc_method': 'run-operation'", | ||
iknox-fa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"'indirect_selection': 'eager'", | ||
) | ||
for element in expected: | ||
assert element in str(result) | ||
assert all(element in invocation_dict for element in expected) | ||
|
||
def test_builtin_dbt_metadata_envs_function(self, project, monkeypatch): | ||
envs = { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Tracking this in #6903
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it turns out renaming a symbol in some places and not others is confusing AF. Might as well do it all at once since it's going to require changes in a medium sized pile of tests that have a manually set value for send stats (not sure why, most of them have nothing to do with tracking).
/shrug