Skip to content

Commit

Permalink
Return code or error ignores WarnErrorOptions (#692)
Browse files Browse the repository at this point in the history
Ignore `WarnErrorOptions` string in stdout from dbt-core, do not treat it
as a failure

Closes: #642
  • Loading branch information
adammarples authored Nov 22, 2023
1 parent 0b538a5 commit a52d1b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cosmos/dbt/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def run_command(command: list[str], tmp_dir: Path, env_vars: dict[str, str]) ->
"Unable to run dbt ls command due to missing dbt_packages. Set RenderConfig.dbt_deps=True."
)

if returncode or "Error" in stdout:
if returncode or "Error" in stdout.replace("WarnErrorOptions", ""):
details = stderr or stdout
raise CosmosLoadDbtException(f"Unable to run {command} due to the error:\n{details}")

Expand Down
1 change: 1 addition & 0 deletions tests/dbt/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@ def test_load_dbt_ls_and_manifest_with_model_version(load_method):
"stdout,returncode",
[
("all good", None),
("WarnErrorOptions", None),
pytest.param("fail", 599, marks=pytest.mark.xfail(raises=CosmosLoadDbtException)),
pytest.param("Error", None, marks=pytest.mark.xfail(raises=CosmosLoadDbtException)),
],
Expand Down

0 comments on commit a52d1b7

Please sign in to comment.