diff --git a/core/dbt/parser/manifest.py b/core/dbt/parser/manifest.py index 7ef69e5db1d..1614e327d64 100644 --- a/core/dbt/parser/manifest.py +++ b/core/dbt/parser/manifest.py @@ -651,6 +651,7 @@ def check_for_spaces_in_model_names(self): ) improper_model_names += 1 + # don't note the total of problematic names unless more than 1 if improper_model_names >= 2 and not self.root_project.args.DEBUG: fire_event( Note( diff --git a/tests/functional/manifest_validations/test_check_for_spaces_in_model_names.py b/tests/functional/manifest_validations/test_check_for_spaces_in_model_names.py index 629d08a0da4..4af60506092 100644 --- a/tests/functional/manifest_validations/test_check_for_spaces_in_model_names.py +++ b/tests/functional/manifest_validations/test_check_for_spaces_in_model_names.py @@ -36,9 +36,11 @@ def models(self) -> Dict[str, str]: def tests_warning_when_spaces_in_name(self, project) -> None: event_catcher = EventCatcher(SpacesInModelNameDeprecation) - runner = dbtRunner(callbacks=[event_catcher.catch]) + note_catcher = EventCatcher(Note) + runner = dbtRunner(callbacks=[event_catcher.catch, note_catcher.catch]) runner.invoke(["parse"]) + assert len(note_catcher.caught_events) == 0 assert len(event_catcher.caught_events) == 1 event = event_catcher.caught_events[0] assert "Model `my model` has spaces in its name. This is deprecated" in event.info.msg @@ -60,6 +62,9 @@ def tests_debug_when_spaces_in_name(self, project) -> None: runner.invoke(["parse"]) assert len(spaces_check_catcher.caught_events) == 1 assert len(note_catcher.caught_events) == 1 + assert ( + "Found 2 models with spaces in their names" in note_catcher.caught_events[0].info.msg + ) spaces_check_catcher = EventCatcher(SpacesInModelNameDeprecation) note_catcher = EventCatcher(Note)