Skip to content

Commit

Permalink
Add DbtDatabaseError to test_missing_column_pre_hook
Browse files Browse the repository at this point in the history
  • Loading branch information
aranke committed Oct 1, 2024
1 parent b414668 commit 5e00c4f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions dbt-tests-adapter/dbt/tests/adapter/hooks/test_run_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import pytest

from dbt_common.exceptions import DbtDatabaseError
from dbt.tests.adapter.hooks import fixtures
from dbt.tests.util import check_table_does_not_exist, run_dbt

Expand All @@ -11,8 +12,8 @@ class BasePrePostRunHooks:
@pytest.fixture(scope="function")
def setUp(self, project):
project.run_sql_file(project.test_data_dir / Path("seed_run.sql"))
project.run_sql(f"drop table if exists { project.test_schema }.schemas")
project.run_sql(f"drop table if exists { project.test_schema }.db_schemas")
project.run_sql(f"drop table if exists {project.test_schema}.schemas")
project.run_sql(f"drop table if exists {project.test_schema}.db_schemas")
os.environ["TERM_TEST"] = "TESTING"

@pytest.fixture(scope="class")
Expand Down Expand Up @@ -158,7 +159,8 @@ def project_config_update(self):
}

def test_missing_column_pre_hook(self, project):
run_dbt(["run"], expect_pass=False)
with pytest.raises(DbtDatabaseError, match=r"relation.*?does not exist"):
run_dbt(["run"], expect_pass=False)


class TestAfterRunHooks(BaseAfterRunHooks):
Expand Down

0 comments on commit 5e00c4f

Please sign in to comment.