Skip to content

Commit

Permalink
tests: add test case for zero return code and non empty stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
cliff-lau-cloverhealth committed Sep 20, 2023
1 parent 2c23e99 commit af13013
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/dbt/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,28 @@ def test_load_via_dbt_ls_without_dbt_deps():
assert err_info.value.args[0] == expected


@pytest.mark.integration
@patch("cosmos.dbt.graph.Popen")
def test_load_via_dbt_ls_with_zero_returncode_and_non_empty_stderr(mock_popen, tmp_dbt_project_dir):
mock_popen().communicate.return_value = ("", "Some stderr warnings")
mock_popen().returncode = 0

dbt_project = DbtProject(name=DBT_PIPELINE_NAME, root_dir=tmp_dbt_project_dir)
dbt_graph = DbtGraph(
project=dbt_project,
profile_config=ProfileConfig(
profile_name="default",
target_name="default",
profile_mapping=PostgresUserPasswordProfileMapping(
conn_id="airflow_db",
profile_args={"schema": "public"},
),
),
)

dbt_graph.load_via_dbt_ls() # does not raise exception


@pytest.mark.integration
@patch("cosmos.dbt.graph.Popen")
def test_load_via_dbt_ls_with_non_zero_returncode(mock_popen):
Expand Down

0 comments on commit af13013

Please sign in to comment.