-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Print and use event system (#10131)
- Loading branch information
1 parent
ad61200
commit eb71ad9
Showing
6 changed files
with
38 additions
and
9 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
kind: Fixes | ||
body: Fix json format log and --quiet for ls and jinja print by converting print call | ||
to fire events | ||
time: 2024-05-16T15:39:13.896723-07:00 | ||
custom: | ||
Author: ChenyuLInx | ||
Issue: "8756" |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from argparse import Namespace | ||
from unittest.mock import patch | ||
|
||
from dbt.flags import get_flags, set_from_args | ||
from dbt.task.list import ListTask | ||
from dbt_common.events.types import PrintEvent | ||
|
||
|
||
def test_list_output_results(): | ||
set_from_args(Namespace(models=None), {}) | ||
task = ListTask(get_flags(), None, None) | ||
results = ["node1", "node2", "node3"] | ||
expected_node_results = ["node1", "node2", "node3"] | ||
|
||
with patch("dbt.task.list.fire_event") as mock_fire_event: | ||
node_results = task.output_results(results) | ||
|
||
assert node_results == expected_node_results | ||
# assert called with PrintEvent type object and message 'node1', 'node2', 'node3' | ||
for call_args in mock_fire_event.call_args_list: | ||
assert isinstance(call_args[0][0], PrintEvent) | ||
assert call_args[0][0].msg in expected_node_results |