Skip to content

Commit

Permalink
fix: test_load_via_dbt_ls_with_invalid_dbt_path if user has system dbt
Browse files Browse the repository at this point in the history
  • Loading branch information
jbandoro authored and tatiana committed Nov 16, 2023
1 parent 773fa27 commit 7ec7410
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cosmos/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,13 @@ class ExecutionConfig:

execution_mode: ExecutionMode = ExecutionMode.LOCAL
test_indirect_selection: TestIndirectSelection = TestIndirectSelection.EAGER
dbt_executable_path: str | Path = get_system_dbt()
dbt_executable_path: str | Path | None = None

dbt_project_path: InitVar[str | Path | None] = None

project_path: Path | None = field(init=False)

def __post_init__(self, dbt_project_path: str | Path | None) -> None:
self.project_path = Path(dbt_project_path) if dbt_project_path else None
if not self.dbt_executable_path:
self.dbt_executable_path = get_system_dbt()
3 changes: 2 additions & 1 deletion tests/dbt/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ def test_load_via_dbt_ls_without_profile(mock_validate_dbt_command):
assert err_info.value.args[0] == expected


def test_load_via_dbt_ls_with_invalid_dbt_path():
@patch("cosmos.dbt.executable.shutil.which", return_value=None)
def test_load_via_dbt_ls_with_invalid_dbt_path(mock_which):
project_config = ProjectConfig(dbt_project_path=DBT_PROJECTS_ROOT_DIR / DBT_PROJECT_NAME)
execution_config = ExecutionConfig(dbt_project_path=DBT_PROJECTS_ROOT_DIR / DBT_PROJECT_NAME)
render_config = RenderConfig(
Expand Down

0 comments on commit 7ec7410

Please sign in to comment.