diff --git a/.changes/unreleased/Fixes-20230419-142150.yaml b/.changes/unreleased/Fixes-20230419-142150.yaml new file mode 100644 index 00000000000..dec4790c6cf --- /dev/null +++ b/.changes/unreleased/Fixes-20230419-142150.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Fix dbt command missing target-path param +time: 2023-04-19T14:21:50.959786-07:00 +custom: + Author: ChenyuLInx + Issue: "\t7411" diff --git a/core/dbt/cli/params.py b/core/dbt/cli/params.py index c815e272740..20fb26c11d7 100644 --- a/core/dbt/cli/params.py +++ b/core/dbt/cli/params.py @@ -1,4 +1,4 @@ -from pathlib import Path, PurePath +from pathlib import Path import click from dbt.cli.options import MultiOption @@ -229,7 +229,7 @@ envvar=None, help="Specify the output path for the JSON report. By default, outputs to 'target/sources.json'", type=click.Path(file_okay=True, dir_okay=False, writable=True), - default=PurePath.joinpath(Path.cwd(), "target/sources.json"), + default=None, ) partial_parse = click.option( diff --git a/tests/functional/sources/test_source_freshness.py b/tests/functional/sources/test_source_freshness.py index 4d468bb5865..13dfa0bc7f2 100644 --- a/tests/functional/sources/test_source_freshness.py +++ b/tests/functional/sources/test_source_freshness.py @@ -187,8 +187,15 @@ def test_source_snapshot_freshness(self, project): class TestSourceFreshnessSelection(SuccessfulSourceFreshnessTest): - def test_source_freshness_selection_select(self, project): + @pytest.fixture(scope="class") + def project_config_update(self, logs_dir): + return { + "target-path": logs_dir, + } + + def test_source_freshness_selection_select(self, project, logs_dir): """Tests node selection using the --select argument.""" + """Also validate that specify a target-path works as expected.""" self._set_updated_at_to(project, timedelta(hours=-2)) # select source directly results = self.run_dbt_with_vars( @@ -198,13 +205,11 @@ def test_source_freshness_selection_select(self, project): "freshness", "--select", "source:test_source.test_table", - "-o", - "target/pass_source.json", ], ) assert len(results) == 1 assert results[0].status == "pass" - self._assert_freshness_results("target/pass_source.json", "pass") + self._assert_freshness_results(f"{logs_dir}/sources.json", "pass") class TestSourceFreshnessExclude(SuccessfulSourceFreshnessTest):