Skip to content

Commit

Permalink
Fix Project Env Var Tests (#6916)
Browse files Browse the repository at this point in the history
Co-authored-by: Jeremy Cohen <jeremy@dbtlabs.com>
Co-authored-by: Ian Knox <ian.knox@dbtlabs.com>
  • Loading branch information
3 people authored Feb 9, 2023
1 parent db2b120 commit 8bbae79
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions core/dbt/tests/fixtures/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ def __init__(
test_data_dir,
test_schema,
database,
logs_dir,
test_config,
):
self.project_root = project_root
Expand All @@ -391,6 +392,7 @@ def __init__(
self.test_data_dir = test_data_dir
self.test_schema = test_schema
self.database = database
self.logs_dir = logs_dir
self.test_config = test_config
self.created_schemas = []

Expand Down Expand Up @@ -486,6 +488,7 @@ def project(
test_data_dir=test_data_dir,
test_schema=unique_schema,
database=adapter.config.credentials.database,
logs_dir=logs_dir,
test_config=test_config,
)
project.drop_test_schema()
Expand Down
7 changes: 4 additions & 3 deletions tests/adapter/dbt/tests/adapter/dbt_debug/test_dbt_debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import os
import re
import yaml

from dbt.cli.main import dbtUsageException
from dbt.tests.util import run_dbt

MODELS__MODEL_SQL = """
Expand Down Expand Up @@ -86,9 +88,8 @@ def test_badproject(self, project):
self.check_project(splitout)

def test_not_found_project(self, project):
run_dbt(["debug", "--project-dir", "nopass"], expect_pass=False)
splitout = self.capsys.readouterr().out.split("\n")
self.check_project(splitout, msg="ERROR not found")
with pytest.raises(dbtUsageException):
run_dbt(["debug", "--project-dir", "nopass"])

def test_invalid_project_outside_current_dir(self, project):
# create a dbt_project.yml
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/partial_parsing/test_pp_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def test_profile_env_vars(self, project):
with pytest.raises(FailedToConnectError):
run_dbt(["run"], expect_pass=False)

log_output = Path(project.project_root, "logs", "dbt.log").read_text()
log_output = Path(project.logs_dir, "dbt.log").read_text()
assert "env vars used in profiles.yml have changed" in log_output

manifest = get_manifest(project.project_root)
Expand Down

0 comments on commit 8bbae79

Please sign in to comment.