diff --git a/core/dbt/clients/jinja.py b/core/dbt/clients/jinja.py index 156017a38cb..de2c3e00494 100644 --- a/core/dbt/clients/jinja.py +++ b/core/dbt/clients/jinja.py @@ -219,7 +219,7 @@ def __getattr__(self, name): return self def __call__(self, *args, **kwargs): - return True + return self return ParserMacroCapture diff --git a/test/integration/006_simple_dependency_test/sad_iteration_models/iterate.sql b/test/integration/006_simple_dependency_test/sad_iteration_models/iterate.sql new file mode 100644 index 00000000000..5086cff09bb --- /dev/null +++ b/test/integration/006_simple_dependency_test/sad_iteration_models/iterate.sql @@ -0,0 +1,2 @@ +{% for x in no_such_dependency.no_such_method() %} +{% endfor %} diff --git a/test/integration/006_simple_dependency_test/test_local_dependency.py b/test/integration/006_simple_dependency_test/test_local_dependency.py index abc22e5e2c4..b7a231aa3e1 100644 --- a/test/integration/006_simple_dependency_test/test_local_dependency.py +++ b/test/integration/006_simple_dependency_test/test_local_dependency.py @@ -5,6 +5,7 @@ import dbt.config import dbt.exceptions + class TestSimpleDependency(DBTIntegrationTest): @property @@ -45,6 +46,25 @@ def test_postgres_local_dependency(self): ) +class TestMissingDependency(DBTIntegrationTest): + @property + def schema(self): + return "local_dependency_006" + + @property + def models(self): + return "test/integration/006_simple_dependency_test/sad_iteration_models" + + @use_profile('postgres') + def test_postgres_missing_dependency(self): + # dbt should raise a dbt exception, not raise a parse-time TypeError. + with self.assertRaises(dbt.exceptions.Exception) as exc: + self.run_dbt(['compile']) + message = str(exc.exception) + self.assertIn('no_such_dependency', message) + self.assertIn('is undefined', message) + + class TestSimpleDependencyWithSchema(TestSimpleDependency): @property def project_config(self):