Skip to content

Commit

Permalink
add testing
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare committed Sep 16, 2024
1 parent ec049a9 commit f49ae26
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
3 changes: 1 addition & 2 deletions core/dbt/events/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def setup_event_logger(flags, callbacks: List[Callable[[EventMsg], None]] = [])
make_log_dir_if_missing(flags.LOG_PATH)
event_manager = get_event_manager()
event_manager.callbacks = callbacks.copy()
add_callback_to_manager(track_behavior_deprecation_warn)

if flags.LOG_LEVEL != "none":
line_format = _line_format_from_str(flags.LOG_FORMAT, LineFormat.PlainText)
Expand All @@ -91,8 +92,6 @@ def setup_event_logger(flags, callbacks: List[Callable[[EventMsg], None]] = [])
console_config.output_stream = get_capture_stream()
add_logger_to_manager(console_config)

add_callback_to_manager(track_behavior_deprecation_warn)

if flags.LOG_LEVEL_FILE != "none":
# create and add the file logger to the event manager
log_file = os.path.join(flags.LOG_PATH, "dbt.log")
Expand Down
7 changes: 1 addition & 6 deletions core/dbt/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,15 +367,10 @@ def track_deprecation_warn(options):


def track_behavior_deprecation_warn(msg: EventMsg) -> None:
if msg.info.name != "BehaviorDeprecationEvent":
return

if active_user is None:
# cannot track deprecation warnings when active user is None
if msg.info.name != "BehaviorDeprecationEvent" or active_user is None:
return

context = [SelfDescribingJson(BEHAVIOR_DEPRECATION_WARN_SPEC, msg_to_dict(msg))]

track(

Check warning on line 374 in core/dbt/tracking.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/tracking.py#L373-L374

Added lines #L373 - L374 were not covered by tests
active_user,
category="dbt",
Expand Down

0 comments on commit f49ae26

Please sign in to comment.