From 87db12d05b1a07d7b3d41c5b7448c0f6a3e46dbb Mon Sep 17 00:00:00 2001 From: Mila Page <67295367+VersusFacit@users.noreply.github.com> Date: Wed, 12 Oct 2022 13:37:08 -0700 Subject: [PATCH] Ct 1049/migrate 016 macro tests (#5780) * Migrate test * Remove old integration test. * Simplify object definitions since we enforce python 3 * Factor many fixtures into a file. Co-authored-by: Mila Page --- .../deprecated-adapter-macro-models/model.sql | 4 - .../deprecated-adapter-macro/model.sql | 3 - .../fail-missing-macro-models/model.sql | 2 - .../016_macro_tests/macros/my_macros.sql | 30 --- .../016_macro_tests/models/.gitkeep | 0 .../016_macro_tests/models/dep_macro.sql | 4 - .../016_macro_tests/models/local_macro.sql | 12 - .../016_macro_tests/models/ref_macro.sql | 1 - .../no-default-macros/my_macros.sql | 35 --- .../override-get-columns-models/model.sql | 5 - .../macros.sql | 3 - .../package_macro_overrides/macros/macros.sql | 3 - .../016_macro_tests/test_macros.py | 234 ------------------ .../functional/macros/data}/seed.sql | 1 - tests/functional/macros/fixtures.py | 131 ++++++++++ .../package_macro_overrides/dbt_project.yml | 0 .../macros}/macros.sql | 0 tests/functional/macros/test_macros.py | 219 ++++++++++++++++ 18 files changed, 350 insertions(+), 337 deletions(-) delete mode 100644 test/integration/016_macro_tests/deprecated-adapter-macro-models/model.sql delete mode 100644 test/integration/016_macro_tests/deprecated-adapter-macro/model.sql delete mode 100644 test/integration/016_macro_tests/fail-missing-macro-models/model.sql delete mode 100644 test/integration/016_macro_tests/macros/my_macros.sql delete mode 100644 test/integration/016_macro_tests/models/.gitkeep delete mode 100644 test/integration/016_macro_tests/models/dep_macro.sql delete mode 100644 test/integration/016_macro_tests/models/local_macro.sql delete mode 100644 test/integration/016_macro_tests/models/ref_macro.sql delete mode 100644 test/integration/016_macro_tests/no-default-macros/my_macros.sql delete mode 100644 test/integration/016_macro_tests/override-get-columns-models/model.sql delete mode 100644 test/integration/016_macro_tests/override-postgres-get-columns-macros/macros.sql delete mode 100644 test/integration/016_macro_tests/package_macro_overrides/macros/macros.sql delete mode 100644 test/integration/016_macro_tests/test_macros.py rename {test/integration/016_macro_tests => tests/functional/macros/data}/seed.sql (99%) create mode 100644 tests/functional/macros/fixtures.py rename {test/integration/016_macro_tests => tests/functional/macros}/package_macro_overrides/dbt_project.yml (100%) rename {test/integration/016_macro_tests/override-get-columns-macros => tests/functional/macros/package_macro_overrides/macros}/macros.sql (100%) create mode 100644 tests/functional/macros/test_macros.py diff --git a/test/integration/016_macro_tests/deprecated-adapter-macro-models/model.sql b/test/integration/016_macro_tests/deprecated-adapter-macro-models/model.sql deleted file mode 100644 index 37621d3d237..00000000000 --- a/test/integration/016_macro_tests/deprecated-adapter-macro-models/model.sql +++ /dev/null @@ -1,4 +0,0 @@ -{% if some_macro('foo', 'bar') != 'foobar' %} - {% do exceptions.raise_compiler_error('invalid foobar') %} -{% endif %} -select 1 as id diff --git a/test/integration/016_macro_tests/deprecated-adapter-macro/model.sql b/test/integration/016_macro_tests/deprecated-adapter-macro/model.sql deleted file mode 100644 index 9e6eaa46dfc..00000000000 --- a/test/integration/016_macro_tests/deprecated-adapter-macro/model.sql +++ /dev/null @@ -1,3 +0,0 @@ -{% macro some_macro(arg1, arg2) -%} - {{ adapter_macro('some_macro', arg1, arg2) }} -{%- endmacro %} diff --git a/test/integration/016_macro_tests/fail-missing-macro-models/model.sql b/test/integration/016_macro_tests/fail-missing-macro-models/model.sql deleted file mode 100644 index 6faebe5385c..00000000000 --- a/test/integration/016_macro_tests/fail-missing-macro-models/model.sql +++ /dev/null @@ -1,2 +0,0 @@ -{{ dispatch_to_nowhere() }} -select 1 as id diff --git a/test/integration/016_macro_tests/macros/my_macros.sql b/test/integration/016_macro_tests/macros/my_macros.sql deleted file mode 100644 index 827f3f09fba..00000000000 --- a/test/integration/016_macro_tests/macros/my_macros.sql +++ /dev/null @@ -1,30 +0,0 @@ - -{% macro do_something2(foo2, bar2) %} - - select - '{{ foo2 }}' as foo2, - '{{ bar2 }}' as bar2 - -{% endmacro %} - - -{% macro with_ref() %} - - {{ ref('table_model') }} - -{% endmacro %} - - -{% macro dispatch_to_parent() %} - {% set macro = adapter.dispatch('dispatch_to_parent') %} - {{ macro() }} -{% endmacro %} - -{% macro default__dispatch_to_parent() %} - {% set msg = 'No default implementation of dispatch_to_parent' %} - {{ exceptions.raise_compiler_error(msg) }} -{% endmacro %} - -{% macro postgres__dispatch_to_parent() %} - {{ return('') }} -{% endmacro %} diff --git a/test/integration/016_macro_tests/models/.gitkeep b/test/integration/016_macro_tests/models/.gitkeep deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/test/integration/016_macro_tests/models/dep_macro.sql b/test/integration/016_macro_tests/models/dep_macro.sql deleted file mode 100644 index 45cfa004059..00000000000 --- a/test/integration/016_macro_tests/models/dep_macro.sql +++ /dev/null @@ -1,4 +0,0 @@ - -{{ - dbt_integration_project.do_something("arg1", "arg2") -}} diff --git a/test/integration/016_macro_tests/models/local_macro.sql b/test/integration/016_macro_tests/models/local_macro.sql deleted file mode 100644 index edb66b7a3f3..00000000000 --- a/test/integration/016_macro_tests/models/local_macro.sql +++ /dev/null @@ -1,12 +0,0 @@ - -{{ - do_something2("arg1", "arg2") -}} - -union all - -{{ - test.do_something2("arg3", "arg4") -}} - - diff --git a/test/integration/016_macro_tests/models/ref_macro.sql b/test/integration/016_macro_tests/models/ref_macro.sql deleted file mode 100644 index 0085f69543d..00000000000 --- a/test/integration/016_macro_tests/models/ref_macro.sql +++ /dev/null @@ -1 +0,0 @@ -select * from {{ with_ref() }} diff --git a/test/integration/016_macro_tests/no-default-macros/my_macros.sql b/test/integration/016_macro_tests/no-default-macros/my_macros.sql deleted file mode 100644 index 8980c6c56b6..00000000000 --- a/test/integration/016_macro_tests/no-default-macros/my_macros.sql +++ /dev/null @@ -1,35 +0,0 @@ - -{% macro do_something2(foo2, bar2) %} - - select - '{{ foo2 }}' as foo2, - '{{ bar2 }}' as bar2 - -{% endmacro %} - - -{% macro with_ref() %} - - {{ ref('table_model') }} - -{% endmacro %} - -{# there is no default__dispatch_to_nowhere! #} -{% macro dispatch_to_nowhere() %} - {% set macro = adapter.dispatch('dispatch_to_nowhere') %} - {{ macro() }} -{% endmacro %} - -{% macro dispatch_to_parent() %} - {% set macro = adapter.dispatch('dispatch_to_parent') %} - {{ macro() }} -{% endmacro %} - -{% macro default__dispatch_to_parent() %} - {% set msg = 'No default implementation of dispatch_to_parent' %} - {{ exceptions.raise_compiler_error(msg) }} -{% endmacro %} - -{% macro postgres__dispatch_to_parent() %} - {{ return('') }} -{% endmacro %} diff --git a/test/integration/016_macro_tests/override-get-columns-models/model.sql b/test/integration/016_macro_tests/override-get-columns-models/model.sql deleted file mode 100644 index 7be007e2444..00000000000 --- a/test/integration/016_macro_tests/override-get-columns-models/model.sql +++ /dev/null @@ -1,5 +0,0 @@ -{% set result = adapter.get_columns_in_relation(this) %} -{% if execute and result != 'a string' %} - {% do exceptions.raise_compiler_error('overriding get_columns_in_relation failed') %} -{% endif %} -select 1 as id diff --git a/test/integration/016_macro_tests/override-postgres-get-columns-macros/macros.sql b/test/integration/016_macro_tests/override-postgres-get-columns-macros/macros.sql deleted file mode 100644 index 4de53ba4a18..00000000000 --- a/test/integration/016_macro_tests/override-postgres-get-columns-macros/macros.sql +++ /dev/null @@ -1,3 +0,0 @@ -{% macro postgres__get_columns_in_relation(relation) %} - {{ return('a string') }} -{% endmacro %} diff --git a/test/integration/016_macro_tests/package_macro_overrides/macros/macros.sql b/test/integration/016_macro_tests/package_macro_overrides/macros/macros.sql deleted file mode 100644 index 73fe0ccfb10..00000000000 --- a/test/integration/016_macro_tests/package_macro_overrides/macros/macros.sql +++ /dev/null @@ -1,3 +0,0 @@ -{% macro get_columns_in_relation(relation) %} - {{ return('a string') }} -{% endmacro %} diff --git a/test/integration/016_macro_tests/test_macros.py b/test/integration/016_macro_tests/test_macros.py deleted file mode 100644 index 6314da09f81..00000000000 --- a/test/integration/016_macro_tests/test_macros.py +++ /dev/null @@ -1,234 +0,0 @@ -from test.integration.base import DBTIntegrationTest, use_profile - -import dbt.exceptions -import pytest - - -class TestMacros(DBTIntegrationTest): - - def setUp(self): - DBTIntegrationTest.setUp(self) - self.run_sql_file("seed.sql") - - @property - def schema(self): - return "test_macros_016" - - @property - def models(self): - return "models" - - @property - def packages_config(self): - return { - 'packages': [ - { - 'git': 'https://github.com/dbt-labs/dbt-integration-project', - 'revision': 'dbt/1.0.0', - }, - ] - } - - @property - def project_config(self): - return { - 'config-version': 2, - 'vars': { - 'test': { - 'test': 'DUMMY', - }, - }, - "macro-paths": ["macros"], - } - - @use_profile('postgres') - def test_postgres_working_macros(self): - self.run_dbt(["deps"]) - results = self.run_dbt(["run"]) - self.assertEqual(len(results), 6) - - self.assertTablesEqual("expected_dep_macro", "dep_macro") - self.assertTablesEqual("expected_local_macro", "local_macro") - - -class TestInvalidMacros(DBTIntegrationTest): - - def setUp(self): - DBTIntegrationTest.setUp(self) - - @property - def schema(self): - return "test_macros_016" - - @property - def models(self): - return "models" - - @use_profile('postgres') - def test_postgres_invalid_macro(self): - with pytest.raises(RuntimeError): - self.run_dbt(["run"]) - - -class TestAdapterMacroNoDestination(DBTIntegrationTest): - - @property - def schema(self): - return "test_macros_016" - - @property - def models(self): - return "fail-missing-macro-models" - - @property - def project_config(self): - return { - 'config-version': 2, - "macro-paths": ["no-default-macros"] - } - - @use_profile('postgres') - def test_postgres_invalid_macro(self): - with pytest.raises(dbt.exceptions.CompilationException) as exc: - self.run_dbt(['run']) - - assert "In dispatch: No macro named 'dispatch_to_nowhere' found" in str(exc.value) - - -class TestMacroOverrideBuiltin(DBTIntegrationTest): - @property - def schema(self): - return "test_macros_016" - - @property - def models(self): - return 'override-get-columns-models' - - @property - def project_config(self): - return { - 'config-version': 2, - 'macro-paths': ['override-get-columns-macros'], - } - - @use_profile('postgres') - def test_postgres_overrides(self): - # the first time, the model doesn't exist - self.run_dbt() - self.run_dbt() - - -class TestMacroOverridePackage(DBTIntegrationTest): - """ - The macro in `override-postgres-get-columns-macros` should override the - `get_columns_in_relation` macro by default. - """ - - @property - def schema(self): - return "test_macros_016" - - @property - def models(self): - return 'override-get-columns-models' - - @property - def project_config(self): - return { - 'config-version': 2, - 'macro-paths': ['override-postgres-get-columns-macros'], - } - - @use_profile('postgres') - def test_postgres_overrides(self): - # the first time, the model doesn't exist - self.run_dbt() - self.run_dbt() - - -class TestMacroNotOverridePackage(DBTIntegrationTest): - """ - The macro in `override-postgres-get-columns-macros` does NOT override the - `get_columns_in_relation` macro because we tell dispatch to not look at the - postgres macros. - """ - - @property - def schema(self): - return "test_macros_016" - - @property - def models(self): - return 'override-get-columns-models' - - @property - def project_config(self): - return { - 'config-version': 2, - 'macro-paths': ['override-postgres-get-columns-macros'], - 'dispatch': [{'macro_namespace': 'dbt', 'search_order': ['dbt']}], - } - - @use_profile('postgres') - def test_postgres_overrides(self): - # the first time, the model doesn't exist - self.run_dbt(expect_pass=False) - self.run_dbt(expect_pass=False) - - -class TestDispatchMacroOverrideBuiltin(TestMacroOverrideBuiltin): - # test the same functionality as above, but this time, - # dbt.get_columns_in_relation will dispatch to a default__ macro - # from an installed package, per dispatch config search_order - - @property - def project_config(self): - return { - "config-version": 2, - "dispatch": [ - { - "macro_namespace": "dbt", - "search_order": ["test", "package_macro_overrides", "dbt"], - } - ], - } - - @property - def packages_config(self): - return { - 'packages': [ - { - "local": "./package_macro_overrides", - }, - ] - } - - @use_profile('postgres') - def test_postgres_overrides(self): - self.run_dbt(["deps"]) - super().test_postgres_overrides() - - -class TestAdapterMacroDeprecated(DBTIntegrationTest): - - @property - def schema(self): - return "test_macros_016" - - @property - def models(self): - return "deprecated-adapter-macro-models" - - @property - def project_config(self): - return { - 'config-version': 2, - "macro-paths": ["deprecated-adapter-macro"] - } - - @use_profile('postgres') - def test_postgres_invalid_macro(self): - with pytest.raises(dbt.exceptions.CompilationException) as exc: - self.run_dbt(['run']) - - assert 'The "adapter_macro" macro has been deprecated' in str(exc.value) diff --git a/test/integration/016_macro_tests/seed.sql b/tests/functional/macros/data/seed.sql similarity index 99% rename from test/integration/016_macro_tests/seed.sql rename to tests/functional/macros/data/seed.sql index 8556efdece8..21d96c73df1 100644 --- a/test/integration/016_macro_tests/seed.sql +++ b/tests/functional/macros/data/seed.sql @@ -21,4 +21,3 @@ values ('arg1', 'arg2'), ('arg3', 'arg4'); insert into {schema}.seed (id, updated_at) values (1, '2017-01-01'), (2, '2017-01-02'); - diff --git a/tests/functional/macros/fixtures.py b/tests/functional/macros/fixtures.py new file mode 100644 index 00000000000..f1e7841f58e --- /dev/null +++ b/tests/functional/macros/fixtures.py @@ -0,0 +1,131 @@ +models__dep_macro = """ +{{ + dbt_integration_project.do_something("arg1", "arg2") +}} +""" + +models__with_undefined_macro = """ +{{ dispatch_to_nowhere() }} +select 1 as id +""" + +models__local_macro = """ +{{ + do_something2("arg1", "arg2") +}} + +union all + +{{ + test.do_something2("arg3", "arg4") +}} +""" + +models__ref_macro = """ +select * from {{ with_ref() }} +""" + +models__override_get_columns_macros = """ +{% set result = adapter.get_columns_in_relation(this) %} +{% if execute and result != 'a string' %} + {% do exceptions.raise_compiler_error('overriding get_columns_in_relation failed') %} +{% endif %} +select 1 as id +""" + +models__deprecated_adapter_macro_model = """ +{% if some_macro('foo', 'bar') != 'foobar' %} + {% do exceptions.raise_compiler_error('invalid foobar') %} +{% endif %} +select 1 as id +""" + +# +# Macros +# +macros__my_macros = """ +{% macro do_something2(foo2, bar2) %} + + select + '{{ foo2 }}' as foo2, + '{{ bar2 }}' as bar2 + +{% endmacro %} + + +{% macro with_ref() %} + + {{ ref('table_model') }} + +{% endmacro %} + + +{% macro dispatch_to_parent() %} + {% set macro = adapter.dispatch('dispatch_to_parent') %} + {{ macro() }} +{% endmacro %} + +{% macro default__dispatch_to_parent() %} + {% set msg = 'No default implementation of dispatch_to_parent' %} + {{ exceptions.raise_compiler_error(msg) }} +{% endmacro %} + +{% macro postgres__dispatch_to_parent() %} + {{ return('') }} +{% endmacro %} +""" + +macros__no_default_macros = """ +{% macro do_something2(foo2, bar2) %} + + select + '{{ foo2 }}' as foo2, + '{{ bar2 }}' as bar2 + +{% endmacro %} + + +{% macro with_ref() %} + + {{ ref('table_model') }} + +{% endmacro %} + +{# there is no default__dispatch_to_nowhere! #} +{% macro dispatch_to_nowhere() %} + {% set macro = adapter.dispatch('dispatch_to_nowhere') %} + {{ macro() }} +{% endmacro %} + +{% macro dispatch_to_parent() %} + {% set macro = adapter.dispatch('dispatch_to_parent') %} + {{ macro() }} +{% endmacro %} + +{% macro default__dispatch_to_parent() %} + {% set msg = 'No default implementation of dispatch_to_parent' %} + {{ exceptions.raise_compiler_error(msg) }} +{% endmacro %} + +{% macro postgres__dispatch_to_parent() %} + {{ return('') }} +{% endmacro %} +""" + +macros__override_get_columns_macros = """ +{% macro get_columns_in_relation(relation) %} + {{ return('a string') }} +{% endmacro %} +""" + +macros__package_override_get_columns_macros = """ +{% macro postgres__get_columns_in_relation(relation) %} + {{ return('a string') }} +{% endmacro %} +""" + +macros__deprecated_adapter_macro = """ +{% macro some_macro(arg1, arg2) -%} + {{ adapter_macro('some_macro', arg1, arg2) }} +{%- endmacro %} +""" diff --git a/test/integration/016_macro_tests/package_macro_overrides/dbt_project.yml b/tests/functional/macros/package_macro_overrides/dbt_project.yml similarity index 100% rename from test/integration/016_macro_tests/package_macro_overrides/dbt_project.yml rename to tests/functional/macros/package_macro_overrides/dbt_project.yml diff --git a/test/integration/016_macro_tests/override-get-columns-macros/macros.sql b/tests/functional/macros/package_macro_overrides/macros/macros.sql similarity index 100% rename from test/integration/016_macro_tests/override-get-columns-macros/macros.sql rename to tests/functional/macros/package_macro_overrides/macros/macros.sql diff --git a/tests/functional/macros/test_macros.py b/tests/functional/macros/test_macros.py new file mode 100644 index 00000000000..899be2453b1 --- /dev/null +++ b/tests/functional/macros/test_macros.py @@ -0,0 +1,219 @@ +import pytest +import shutil + +import dbt.exceptions + +from pathlib import Path + +from dbt.tests.util import ( + run_dbt, + check_relations_equal, +) + +from tests.functional.macros.fixtures import ( + models__dep_macro, + models__with_undefined_macro, + models__local_macro, + models__ref_macro, + models__override_get_columns_macros, + models__deprecated_adapter_macro_model, + macros__my_macros, + macros__no_default_macros, + macros__override_get_columns_macros, + macros__package_override_get_columns_macros, + macros__deprecated_adapter_macro, +) + + +class TestMacros: + @pytest.fixture(scope="class", autouse=True) + def setUp(self, project): + project.run_sql_file(project.test_data_dir / Path("seed.sql")) + + @pytest.fixture(scope="class") + def models(self): + return { + "dep_macro.sql": models__dep_macro, + "local_macro.sql": models__local_macro, + "ref_macro.sql": models__ref_macro, + } + + @pytest.fixture(scope="class") + def macros(self): + return {"my_macros.sql": macros__my_macros} + + @pytest.fixture(scope="class") + def packages(self): + return { + "packages": [ + { + "git": "https://github.com/dbt-labs/dbt-integration-project", + "revision": "dbt/1.0.0", + }, + ] + } + + @pytest.fixture(scope="class") + def project_config_update(self): + return { + "config-version": 2, + "vars": { + "test": { + "test": "DUMMY", + }, + }, + "macro-paths": ["macros"], + } + + def test_working_macros(self, project): + run_dbt(["deps"]) + results = run_dbt() + assert len(results) == 6 + + check_relations_equal(project.adapter, ["expected_dep_macro", "dep_macro"]) + check_relations_equal(project.adapter, ["expected_local_macro", "local_macro"]) + + +class TestInvalidMacros: + @pytest.fixture(scope="class") + def models(self): + return { + "dep_macro.sql": models__dep_macro, + "local_macro.sql": models__local_macro, + "ref_macro.sql": models__ref_macro, + } + + def test_invalid_macro(self, project): + run_dbt(expect_pass=False) + + +class TestAdapterMacroNoDestination: + @pytest.fixture(scope="class") + def models(self): + return {"model.sql": models__with_undefined_macro} + + @pytest.fixture(scope="class") + def macros(self): + return {"my_macros.sql": macros__no_default_macros} + + def test_invalid_macro(self, project): + with pytest.raises(dbt.exceptions.CompilationException) as exc: + run_dbt() + + assert "In dispatch: No macro named 'dispatch_to_nowhere' found" in str(exc.value) + + +class TestMacroOverrideBuiltin: + @pytest.fixture(scope="class") + def models(self): + return {"model.sql": models__override_get_columns_macros} + + @pytest.fixture(scope="class") + def macros(self): + return {"macros.sql": macros__override_get_columns_macros} + + def test_overrides(self, project): + # the first time, the model doesn't exist + run_dbt() + run_dbt() + + +class TestMacroOverridePackage: + """ + The macro in `override-postgres-get-columns-macros` should override the + `get_columns_in_relation` macro by default. + """ + + @pytest.fixture(scope="class") + def models(self): + return {"model.sql": models__override_get_columns_macros} + + @pytest.fixture(scope="class") + def macros(self): + return {"macros.sql": macros__package_override_get_columns_macros} + + def test_overrides(self, project): + # the first time, the model doesn't exist + run_dbt() + run_dbt() + + +class TestMacroNotOverridePackage: + """ + The macro in `override-postgres-get-columns-macros` does NOT override the + `get_columns_in_relation` macro because we tell dispatch to not look at the + postgres macros. + """ + + @pytest.fixture(scope="class") + def models(self): + return {"model.sql": models__override_get_columns_macros} + + @pytest.fixture(scope="class") + def macros(self): + return {"macros.sql": macros__package_override_get_columns_macros} + + @pytest.fixture(scope="class") + def project_config_update(self): + return { + "dispatch": [{"macro_namespace": "dbt", "search_order": ["dbt"]}], + } + + def test_overrides(self, project): + # the first time, the model doesn't exist + run_dbt(expect_pass=False) + run_dbt(expect_pass=False) + + +class TestDispatchMacroOverrideBuiltin(TestMacroOverrideBuiltin): + # test the same functionality as above, but this time, + # dbt.get_columns_in_relation will dispatch to a default__ macro + # from an installed package, per dispatch config search_order + @pytest.fixture(scope="class", autouse=True) + def setUp(self, project): + shutil.copytree( + project.test_dir / Path("package_macro_overrides"), + project.project_root / Path("package_macro_overrides"), + ) + + @pytest.fixture(scope="class") + def project_config_update(self): + return { + "dispatch": [ + { + "macro_namespace": "dbt", + "search_order": ["test", "package_macro_overrides", "dbt"], + } + ], + } + + @pytest.fixture(scope="class") + def packages(self): + return { + "packages": [ + { + "local": "./package_macro_overrides", + }, + ] + } + + def test_overrides(self, project): + run_dbt(["deps"]) + run_dbt() + run_dbt() + + +class TestAdapterMacroDeprecated: + @pytest.fixture(scope="class") + def models(self): + return {"model.sql": models__deprecated_adapter_macro_model} + + @pytest.fixture(scope="class") + def macros(self): + return {"macro.sql": macros__deprecated_adapter_macro} + + def test_invalid_macro(self, project): + with pytest.raises(dbt.exceptions.CompilationException) as exc: + run_dbt() + + assert 'The "adapter_macro" macro has been deprecated' in str(exc.value)