Repository: dbt-labs/dbt-core

Issue:
[CT-1794] Remove deprecated exception functions
Follow up on: #6393 

Completely remove the functions marked as deprecated from `exceptions.py`.


Discussion:
In the changelog message for this, let's be sure to:
- mark as a Breaking Change
- explicitly say "For adapter maintainers"

Resolving patch:
diff --git a/core/dbt/exceptions.py b/core/dbt/exceptions.py
--- a/core/dbt/exceptions.py
+++ b/core/dbt/exceptions.py
@@ -1,14 +1,10 @@
 import builtins
 import json
 import re
-from typing import Any, Dict, List, Mapping, NoReturn, Optional, Union
+from typing import Any, Dict, List, Mapping, Optional, Union
 
 from dbt.dataclass_schema import ValidationError
-from dbt.internal_deprecations import deprecated
-from dbt.events.functions import warn_or_error
 from dbt.events.helpers import env_secrets, scrub_secrets
-from dbt.events.types import JinjaLogWarning
-from dbt.events.contextvars import get_node_info
 from dbt.node_types import NodeType
 from dbt.ui import line_wrap_message
 
@@ -2235,468 +2231,3 @@ def __init__(self, cause: Dict[str, Any]):
 
     def data(self):
         return {"cause": self.cause, "message": self.msg}
-
-
-# These are copies of what's in dbt/context/exceptions_jinja.py to not immediately break adapters
-# utilizing these functions as exceptions.  These are direct copies to avoid circular imports.
-# They will be removed in 1 (or 2?) versions.  Issue to be created to ensure it happens.
-
-# TODO: add deprecation to functions
-DEPRECATION_VERSION = "1.5.0"
-SUGGESTED_ACTION = "using `raise {exception}` directly instead"
-REASON = "See https://github.com/dbt-labs/dbt-core/issues/6393 for more details"
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="JinjaLogWarning"),
-    reason=REASON,
-)
-def warn(msg, node=None):
-    warn_or_error(JinjaLogWarning(msg=msg, node_info=get_node_info()))
-    return ""
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="MissingConfigError"),
-    reason=REASON,
-)
-def missing_config(model, name) -> NoReturn:
-    raise MissingConfigError(unique_id=model.unique_id, name=name)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="MissingMaterializationError"),
-    reason=REASON,
-)
-def missing_materialization(model, adapter_type) -> NoReturn:
-    materialization = model.config.materialized
-    raise MissingMaterializationError(materialization=materialization, adapter_type=adapter_type)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="MissingRelationError"),
-    reason=REASON,
-)
-def missing_relation(relation, model=None) -> NoReturn:
-    raise MissingRelationError(relation, model)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="AmbiguousAliasError"),
-    reason=REASON,
-)
-def raise_ambiguous_alias(node_1, node_2, duped_name=None) -> NoReturn:
-    raise AmbiguousAliasError(node_1, node_2, duped_name)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="AmbiguousCatalogMatchError"),
-    reason=REASON,
-)
-def raise_ambiguous_catalog_match(unique_id, match_1, match_2) -> NoReturn:
-    raise AmbiguousCatalogMatchError(unique_id, match_1, match_2)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="CacheInconsistencyError"),
-    reason=REASON,
-)
-def raise_cache_inconsistent(message) -> NoReturn:
-    raise CacheInconsistencyError(message)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="DataclassNotDictError"),
-    reason=REASON,
-)
-def raise_dataclass_not_dict(obj) -> NoReturn:
-    raise DataclassNotDictError(obj)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="CompilationError"),
-    reason=REASON,
-)
-def raise_compiler_error(msg, node=None) -> NoReturn:
-    raise CompilationError(msg, node)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="DbtDatabaseError"),
-    reason=REASON,
-)
-def raise_database_error(msg, node=None) -> NoReturn:
-    raise DbtDatabaseError(msg, node)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="DependencyNotFoundError"),
-    reason=REASON,
-)
-def raise_dep_not_found(node, node_description, required_pkg) -> NoReturn:
-    raise DependencyNotFoundError(node, node_description, required_pkg)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="DependencyError"),
-    reason=REASON,
-)
-def raise_dependency_error(msg) -> NoReturn:
-    raise DependencyError(scrub_secrets(msg, env_secrets()))
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="DuplicatePatchPathError"),
-    reason=REASON,
-)
-def raise_duplicate_patch_name(patch_1, existing_patch_path) -> NoReturn:
-    raise DuplicatePatchPathError(patch_1, existing_patch_path)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="DuplicateResourceNameError"),
-    reason=REASON,
-)
-def raise_duplicate_resource_name(node_1, node_2) -> NoReturn:
-    raise DuplicateResourceNameError(node_1, node_2)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="PropertyYMLError"),
-    reason=REASON,
-)
-def raise_invalid_property_yml_version(path, issue) -> NoReturn:
-    raise PropertyYMLError(path, issue)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="NotImplementedError"),
-    reason=REASON,
-)
-def raise_not_implemented(msg) -> NoReturn:
-    raise NotImplementedError(msg)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="RelationWrongTypeError"),
-    reason=REASON,
-)
-def relation_wrong_type(relation, expected_type, model=None) -> NoReturn:
-    raise RelationWrongTypeError(relation, expected_type, model)
-
-
-# these were implemented in core so deprecating here by calling the new exception directly
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="DuplicateAliasError"),
-    reason=REASON,
-)
-def raise_duplicate_alias(
-    kwargs: Mapping[str, Any], aliases: Mapping[str, str], canonical_key: str
-) -> NoReturn:
-    raise DuplicateAliasError(kwargs, aliases, canonical_key)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="DuplicateSourcePatchNameError"),
-    reason=REASON,
-)
-def raise_duplicate_source_patch_name(patch_1, patch_2):
-    raise DuplicateSourcePatchNameError(patch_1, patch_2)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="DuplicateMacroPatchNameError"),
-    reason=REASON,
-)
-def raise_duplicate_macro_patch_name(patch_1, existing_patch_path):
-    raise DuplicateMacroPatchNameError(patch_1, existing_patch_path)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="DuplicateMacroNameError"),
-    reason=REASON,
-)
-def raise_duplicate_macro_name(node_1, node_2, namespace) -> NoReturn:
-    raise DuplicateMacroNameError(node_1, node_2, namespace)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="ApproximateMatchError"),
-    reason=REASON,
-)
-def approximate_relation_match(target, relation):
-    raise ApproximateMatchError(target, relation)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="RelationReturnedMultipleResultsError"),
-    reason=REASON,
-)
-def get_relation_returned_multiple_results(kwargs, matches):
-    raise RelationReturnedMultipleResultsError(kwargs, matches)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="OperationError"),
-    reason=REASON,
-)
-def system_error(operation_name):
-    raise OperationError(operation_name)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="InvalidMaterializationArgError"),
-    reason=REASON,
-)
-def invalid_materialization_argument(name, argument):
-    raise MaterializationArgError(name, argument)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="BadSpecError"),
-    reason=REASON,
-)
-def bad_package_spec(repo, spec, error_message):
-    raise BadSpecError(spec, repo, error_message)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="CommandResultError"),
-    reason=REASON,
-)
-def raise_git_cloning_error(error: CommandResultError) -> NoReturn:
-    raise error
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="UnknownGitCloningProblemError"),
-    reason=REASON,
-)
-def raise_git_cloning_problem(repo) -> NoReturn:
-    raise UnknownGitCloningProblemError(repo)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="MacroDispatchArgError"),
-    reason=REASON,
-)
-def macro_invalid_dispatch_arg(macro_name) -> NoReturn:
-    raise MacroDispatchArgError(macro_name)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="GraphDependencyNotFoundError"),
-    reason=REASON,
-)
-def dependency_not_found(node, dependency):
-    raise GraphDependencyNotFoundError(node, dependency)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="TargetNotFoundError"),
-    reason=REASON,
-)
-def target_not_found(
-    node,
-    target_name: str,
-    target_kind: str,
-    target_package: Optional[str] = None,
-    disabled: Optional[bool] = None,
-) -> NoReturn:
-    raise TargetNotFoundError(
-        node=node,
-        target_name=target_name,
-        target_kind=target_kind,
-        target_package=target_package,
-        disabled=disabled,
-    )
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="DocTargetNotFoundError"),
-    reason=REASON,
-)
-def doc_target_not_found(
-    model, target_doc_name: str, target_doc_package: Optional[str] = None
-) -> NoReturn:
-    raise DocTargetNotFoundError(
-        node=model, target_doc_name=target_doc_name, target_doc_package=target_doc_package
-    )
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="DocArgsError"),
-    reason=REASON,
-)
-def doc_invalid_args(model, args) -> NoReturn:
-    raise DocArgsError(node=model, args=args)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="RefBadContextError"),
-    reason=REASON,
-)
-def ref_bad_context(model, args) -> NoReturn:
-    raise RefBadContextError(node=model, args=args)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="MetricArgsError"),
-    reason=REASON,
-)
-def metric_invalid_args(model, args) -> NoReturn:
-    raise MetricArgsError(node=model, args=args)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="RefArgsError"),
-    reason=REASON,
-)
-def ref_invalid_args(model, args) -> NoReturn:
-    raise RefArgsError(node=model, args=args)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="BooleanError"),
-    reason=REASON,
-)
-def invalid_bool_error(got_value, macro_name) -> NoReturn:
-    raise BooleanError(return_value=got_value, macro_name=macro_name)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="MacroArgTypeError"),
-    reason=REASON,
-)
-def invalid_type_error(method_name, arg_name, got_value, expected_type) -> NoReturn:
-    """Raise a InvalidMacroArgType when an adapter method available to macros
-    has changed.
-    """
-    raise MacroArgTypeError(method_name, arg_name, got_value, expected_type)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="SecretEnvVarLocationError"),
-    reason=REASON,
-)
-def disallow_secret_env_var(env_var_name) -> NoReturn:
-    """Raise an error when a secret env var is referenced outside allowed
-    rendering contexts"""
-    raise SecretEnvVarLocationError(env_var_name)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="ParsingError"),
-    reason=REASON,
-)
-def raise_parsing_error(msg, node=None) -> NoReturn:
-    raise ParsingError(msg, node)
-
-
-# These are the exceptions functions that were not called within dbt-core but will remain
-# here deprecated to give a chance for adapters to rework
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="UnrecognizedCredentialTypeError"),
-    reason=REASON,
-)
-def raise_unrecognized_credentials_type(typename, supported_types):
-    raise UnrecognizedCredentialTypeError(typename, supported_types)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="PatchTargetNotFoundError"),
-    reason=REASON,
-)
-def raise_patch_targets_not_found(patches):
-    raise PatchTargetNotFoundError(patches)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="RelationReturnedMultipleResultsError"),
-    reason=REASON,
-)
-def multiple_matching_relations(kwargs, matches):
-    raise RelationReturnedMultipleResultsError(kwargs, matches)
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="MaterializationNotAvailableError"),
-    reason=REASON,
-)
-def materialization_not_available(model, adapter_type):
-    materialization = model.config.materialized
-    raise MaterializationNotAvailableError(
-        materialization=materialization, adapter_type=adapter_type
-    )
-
-
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action=SUGGESTED_ACTION.format(exception="MacroNotFoundError"),
-    reason=REASON,
-)
-def macro_not_found(model, target_macro_id):
-    raise MacroNotFoundError(node=model, target_macro_id=target_macro_id)
-
-
-# adapters use this to format messages.  it should be deprecated but live on for now
-# TODO: What should the message here be?
-@deprecated(
-    version=DEPRECATION_VERSION,
-    suggested_action="Format this message in the adapter",
-    reason="`validator_error_message` is now a mathod on DbtRuntimeError",
-)
-def validator_error_message(exc):
-    """Given a dbt.dataclass_schema.ValidationError (which is basically a
-    jsonschema.ValidationError), return the relevant parts as a string
-    """
-    if not isinstance(exc, dbt.dataclass_schema.ValidationError):
-        return str(exc)
-    path = "[%s]" % "][".join(map(repr, exc.relative_path))
-    return "at path {}: {}".format(path, exc.message)


Test patch:
diff --git a/test/unit/test_exceptions.py b/test/unit/test_exceptions.py
deleted file mode 100644
--- a/test/unit/test_exceptions.py
+++ /dev/null
@@ -1,35 +0,0 @@
-import pytest
-
-from dbt.exceptions import raise_duplicate_macro_name, CompilationError
-from .utils import MockMacro
-
-
-def test_raise_duplicate_macros_different_package():
-    macro_1 = MockMacro(package="dbt", name="some_macro")
-    macro_2 = MockMacro(package="dbt-myadapter", name="some_macro")
-
-    with pytest.raises(CompilationError) as exc:
-        raise_duplicate_macro_name(
-            node_1=macro_1,
-            node_2=macro_2,
-            namespace="dbt",
-        )
-    assert "dbt-myadapter" in str(exc.value)
-    assert "some_macro" in str(exc.value)
-    assert 'namespace "dbt"' in str(exc.value)
-    assert '("dbt" and "dbt-myadapter" are both in the "dbt" namespace)' in str(exc.value)
-
-
-def test_raise_duplicate_macros_same_package():
-    macro_1 = MockMacro(package="dbt", name="some_macro")
-    macro_2 = MockMacro(package="dbt", name="some_macro")
-
-    with pytest.raises(CompilationError) as exc:
-        raise_duplicate_macro_name(
-            node_1=macro_1,
-            node_2=macro_2,
-            namespace="dbt",
-        )
-    assert "some_macro" in str(exc.value)
-    assert 'namespace "dbt"' in str(exc.value)
-    assert "are both in" not in str(exc.value)
diff --git a/tests/unit/test_deprecations.py b/tests/unit/test_deprecations.py
--- a/tests/unit/test_deprecations.py
+++ b/tests/unit/test_deprecations.py
@@ -1,9 +1,4 @@
-import argparse
-import pytest
-
 from dbt.internal_deprecations import deprecated
-import dbt.exceptions
-from dbt.node_types import NodeType
 from dbt.flags import set_from_args
 from argparse import Namespace
 
@@ -13,597 +8,8 @@ def to_be_decorated():
     return 5
 
 
-# simpletest that the return value is not modified
+# simple test that the return value is not modified
 def test_deprecated_func():
     set_from_args(Namespace(WARN_ERROR=False), None)
     assert hasattr(to_be_decorated, "__wrapped__")
     assert to_be_decorated() == 5
-
-
-class TestDeprecatedFunctions:
-    def is_deprecated(self, func):
-        assert hasattr(func, "__wrapped__")
-        # TODO: add in log check
-
-    def test_warn(self):
-        self.is_deprecated(dbt.exceptions.warn)
-
-
-class TestDeprecatedExceptionFunctions:
-    @pytest.fixture(scope="class", autouse=True)
-    def setUp(self):
-        set_from_args(Namespace(WARN_ERROR=False), None)
-
-    def runFunc(self, func, *args):
-        return func(*args)
-
-    def is_deprecated(self, func):
-        assert hasattr(func, "__wrapped__")
-        # TODO: add in log check
-
-    def test_missing_config(self):
-        func = dbt.exceptions.missing_config
-        exception = dbt.exceptions.MissingConfigError
-        model = argparse.Namespace()
-        model.unique_id = ""
-        name = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(model, name)
-
-    def test_missing_materialization(self):
-        func = dbt.exceptions.missing_materialization
-        exception = dbt.exceptions.MissingMaterializationError
-        model = argparse.Namespace()
-        model.config = argparse.Namespace()
-        model.config.materialized = ""
-        adapter_type = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(model, adapter_type)
-
-    def test_missing_relation(self):
-        func = dbt.exceptions.missing_relation
-        exception = dbt.exceptions.MissingRelationError
-        relation = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(relation)
-
-    def test_raise_ambiguous_alias(self):
-        func = dbt.exceptions.raise_ambiguous_alias
-        exception = dbt.exceptions.AmbiguousAliasError
-        node_1 = argparse.Namespace()
-        node_1.unique_id = ""
-        node_1.original_file_path = ""
-        node_2 = argparse.Namespace()
-        node_2.unique_id = ""
-        node_2.original_file_path = ""
-        duped_name = "string"
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(node_1, node_2, duped_name)
-
-    def test_raise_ambiguous_catalog_match(self):
-        func = dbt.exceptions.raise_ambiguous_catalog_match
-        exception = dbt.exceptions.AmbiguousCatalogMatchError
-        unique_id = ""
-        match_1 = {"metadata": {"schema": ""}}
-        match_2 = {"metadata": {"schema": ""}}
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(unique_id, match_1, match_2)
-
-    def test_raise_cache_inconsistent(self):
-        func = dbt.exceptions.raise_cache_inconsistent
-        exception = dbt.exceptions.CacheInconsistencyError
-        msg = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(msg)
-
-    def test_raise_dataclass_not_dict(self):
-        func = dbt.exceptions.raise_dataclass_not_dict
-        exception = dbt.exceptions.DataclassNotDictError
-        obj = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(obj)
-
-    def test_raise_compiler_error(self):
-        func = dbt.exceptions.raise_compiler_error
-        exception = dbt.exceptions.CompilationError
-        msg = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(msg)
-
-    def test_raise_database_error(self):
-        func = dbt.exceptions.raise_database_error
-        exception = dbt.exceptions.DbtDatabaseError
-        msg = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(msg)
-
-    def test_raise_dep_not_found(self):
-        func = dbt.exceptions.raise_dep_not_found
-        exception = dbt.exceptions.DependencyNotFoundError
-        node = ""
-        node_description = ""
-        required_pkg = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(node, node_description, required_pkg)
-
-    def test_raise_dependency_error(self):
-        func = dbt.exceptions.raise_dependency_error
-        exception = dbt.exceptions.DependencyError
-        msg = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(msg)
-
-    def test_raise_duplicate_patch_name(self):
-        func = dbt.exceptions.raise_duplicate_patch_name
-        exception = dbt.exceptions.DuplicatePatchPathError
-        patch_1 = argparse.Namespace()
-        patch_1.name = ""
-        patch_1.original_file_path = ""
-        existing_patch_path = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(patch_1, existing_patch_path)
-
-    def test_raise_duplicate_resource_name(self):
-        func = dbt.exceptions.raise_duplicate_resource_name
-        exception = dbt.exceptions.DuplicateResourceNameError
-        node_1 = argparse.Namespace()
-        node_1.name = ""
-        node_1.resource_type = NodeType("model")
-        node_1.column_name = ""
-        node_1.unique_id = ""
-        node_1.original_file_path = ""
-        node_2 = argparse.Namespace()
-        node_2.name = ""
-        node_2.resource_type = ""
-        node_2.unique_id = ""
-        node_2.original_file_path = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(node_1, node_2)
-
-    def test_raise_invalid_property_yml_version(self):
-        func = dbt.exceptions.raise_invalid_property_yml_version
-        exception = dbt.exceptions.PropertyYMLError
-        path = ""
-        issue = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(path, issue)
-
-    def test_raise_not_implemented(self):
-        func = dbt.exceptions.raise_not_implemented
-        exception = dbt.exceptions.NotImplementedError
-        msg = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(msg)
-
-    def test_relation_wrong_type(self):
-        func = dbt.exceptions.relation_wrong_type
-        exception = dbt.exceptions.RelationWrongTypeError
-
-        relation = argparse.Namespace()
-        relation.type = ""
-        expected_type = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(relation, expected_type)
-
-    def test_raise_duplicate_alias(self):
-        func = dbt.exceptions.raise_duplicate_alias
-        exception = dbt.exceptions.DuplicateAliasError
-        kwargs = {"": ""}
-        aliases = {"": ""}
-        canonical_key = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(kwargs, aliases, canonical_key)
-
-    def test_raise_duplicate_source_patch_name(self):
-        func = dbt.exceptions.raise_duplicate_source_patch_name
-        exception = dbt.exceptions.DuplicateSourcePatchNameError
-        patch_1 = argparse.Namespace()
-        patch_1.name = ""
-        patch_1.path = ""
-        patch_1.overrides = ""
-        patch_2 = argparse.Namespace()
-        patch_2.path = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(patch_1, patch_2)
-
-    def test_raise_duplicate_macro_patch_name(self):
-        func = dbt.exceptions.raise_duplicate_macro_patch_name
-        exception = dbt.exceptions.DuplicateMacroPatchNameError
-        patch_1 = argparse.Namespace()
-        patch_1.package_name = ""
-        patch_1.name = ""
-        patch_1.original_file_path = ""
-        existing_patch_path = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(patch_1, existing_patch_path)
-
-    def test_raise_duplicate_macro_name(self):
-        func = dbt.exceptions.raise_duplicate_macro_name
-        exception = dbt.exceptions.DuplicateMacroNameError
-        node_1 = argparse.Namespace()
-        node_1.name = ""
-        node_1.package_name = ""
-        node_1.original_file_path = ""
-        node_1.unique_id = ""
-        node_2 = argparse.Namespace()
-        node_2.package_name = ""
-        node_2.unique_id = ""
-        node_2.original_file_path = ""
-        namespace = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(node_1, node_2, namespace)
-
-    def test_approximate_relation_match(self):
-        func = dbt.exceptions.approximate_relation_match
-        exception = dbt.exceptions.ApproximateMatchError
-        target = ""
-        relation = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(target, relation)
-
-    def test_get_relation_returned_multiple_results(self):
-        func = dbt.exceptions.get_relation_returned_multiple_results
-        exception = dbt.exceptions.RelationReturnedMultipleResultsError
-        kwargs = {}
-        matches = []
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(kwargs, matches)
-
-    def test_system_error(self):
-        func = dbt.exceptions.system_error
-        exception = dbt.exceptions.OperationError
-        operation_name = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(operation_name)
-
-    def test_invalid_materialization_argument(self):
-        func = dbt.exceptions.invalid_materialization_argument
-        exception = dbt.exceptions.MaterializationArgError
-        name = ""
-        argument = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(name, argument)
-
-    def test_bad_package_spec(self):
-        func = dbt.exceptions.bad_package_spec
-        exception = dbt.exceptions.BadSpecError
-        repo = ""
-        spec = ""
-        error = argparse.Namespace()
-        error.stderr = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(repo, spec, error)
-
-    # def test_raise_git_cloning_error(self):
-    #     func = dbt.exceptions.raise_git_cloning_error
-    #     exception = dbt.exceptions.CommandResultError
-
-    #     error = dbt.exceptions.CommandResultError
-    #     error.cwd = ""
-    #     error.cmd = [""]
-    #     error.returncode = 1
-    #     error.stdout = ""
-    #     error.stderr = ""
-
-    #     self.is_deprecated(func)
-
-    #     assert(hasattr(func, '__wrapped__'))
-    #     with pytest.raises(exception):
-    #         func(error)
-
-    def test_raise_git_cloning_problem(self):
-        func = dbt.exceptions.raise_git_cloning_problem
-        exception = dbt.exceptions.UnknownGitCloningProblemError
-        repo = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(repo)
-
-    def test_macro_invalid_dispatch_arg(self):
-        func = dbt.exceptions.macro_invalid_dispatch_arg
-        exception = dbt.exceptions.MacroDispatchArgError
-        macro_name = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(macro_name)
-
-    def test_dependency_not_found(self):
-        func = dbt.exceptions.dependency_not_found
-        exception = dbt.exceptions.GraphDependencyNotFoundError
-        node = argparse.Namespace()
-        node.unique_id = ""
-        dependency = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(node, dependency)
-
-    def test_target_not_found(self):
-        func = dbt.exceptions.target_not_found
-        exception = dbt.exceptions.TargetNotFoundError
-        node = argparse.Namespace()
-        node.unique_id = ""
-        node.original_file_path = ""
-        node.resource_type = ""
-        target_name = ""
-        target_kind = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(node, target_name, target_kind)
-
-    def test_doc_target_not_found(self):
-        func = dbt.exceptions.doc_target_not_found
-        exception = dbt.exceptions.DocTargetNotFoundError
-        model = argparse.Namespace()
-        model.unique_id = ""
-        target_doc_name = ""
-        target_doc_package = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(model, target_doc_name, target_doc_package)
-
-    def test_ref_bad_context(self):
-        func = dbt.exceptions.ref_bad_context
-        exception = dbt.exceptions.RefBadContextError
-        model = argparse.Namespace()
-        model.name = ""
-        args = []
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(model, args)
-
-    def test_metric_invalid_args(self):
-        func = dbt.exceptions.metric_invalid_args
-        exception = dbt.exceptions.MetricArgsError
-        model = argparse.Namespace()
-        model.unique_id = ""
-        args = []
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(model, args)
-
-    def test_ref_invalid_args(self):
-        func = dbt.exceptions.ref_invalid_args
-        exception = dbt.exceptions.RefArgsError
-        model = argparse.Namespace()
-        model.unique_id = ""
-        args = []
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(model, args)
-
-    def test_invalid_bool_error(self):
-        func = dbt.exceptions.invalid_bool_error
-        exception = dbt.exceptions.BooleanError
-        return_value = ""
-        macro_name = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(return_value, macro_name)
-
-    def test_invalid_type_error(self):
-        func = dbt.exceptions.invalid_type_error
-        exception = dbt.exceptions.MacroArgTypeError
-        method_name = ""
-        arg_name = ""
-        got_value = ""
-        expected_type = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(method_name, arg_name, got_value, expected_type)
-
-    def test_disallow_secret_env_var(self):
-        func = dbt.exceptions.disallow_secret_env_var
-        exception = dbt.exceptions.SecretEnvVarLocationError
-        env_var_name = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(env_var_name)
-
-    def test_raise_parsing_error(self):
-        func = dbt.exceptions.raise_parsing_error
-        exception = dbt.exceptions.ParsingError
-        msg = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(msg)
-
-    def test_raise_unrecognized_credentials_type(self):
-        func = dbt.exceptions.raise_unrecognized_credentials_type
-        exception = dbt.exceptions.UnrecognizedCredentialTypeError
-        typename = ""
-        supported_types = []
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(typename, supported_types)
-
-    def test_raise_patch_targets_not_found(self):
-        func = dbt.exceptions.raise_patch_targets_not_found
-        exception = dbt.exceptions.PatchTargetNotFoundError
-        node = argparse.Namespace()
-        node.name = ""
-        node.original_file_path = ""
-        patches = {"patch": node}
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(patches)
-
-    def test_multiple_matching_relations(self):
-        func = dbt.exceptions.multiple_matching_relations
-        exception = dbt.exceptions.RelationReturnedMultipleResultsError
-        kwargs = {}
-        matches = []
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(kwargs, matches)
-
-    def test_materialization_not_available(self):
-        func = dbt.exceptions.materialization_not_available
-        exception = dbt.exceptions.MaterializationNotAvailableError
-        model = argparse.Namespace()
-        model.config = argparse.Namespace()
-        model.config.materialized = ""
-        adapter_type = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(model, adapter_type)
-
-    def test_macro_not_found(self):
-        func = dbt.exceptions.macro_not_found
-        exception = dbt.exceptions.MacroNotFoundError
-        model = argparse.Namespace()
-        model.unique_id = ""
-        target_macro_id = ""
-
-        self.is_deprecated(func)
-
-        assert hasattr(func, "__wrapped__")
-        with pytest.raises(exception):
-            func(model, target_macro_id)