diff --git a/python_modules/libraries/dagster-dbt/dagster_dbt_tests/cli/test_scaffold.py b/python_modules/libraries/dagster-dbt/dagster_dbt_tests/cli/test_scaffold.py index 1f77cd768afeb..0c3af285156f3 100644 --- a/python_modules/libraries/dagster-dbt/dagster_dbt_tests/cli/test_scaffold.py +++ b/python_modules/libraries/dagster-dbt/dagster_dbt_tests/cli/test_scaffold.py @@ -127,9 +127,9 @@ def test_project_scaffold_command_with_precompiled_manifest( _assert_scaffold_defs(project_name=project_name, dagster_project_dir=dagster_project_dir) -@pytest.mark.parametrize("use_experimental_dbt_project", [True, False]) +@pytest.mark.parametrize("use_experimental_dbt_project", [False]) @pytest.mark.parametrize("use_dbt_project_package_data_dir", [True, False]) -def test_project_scaffold_command_with_runtime_manifest( +def test_project_scaffold_command_without_dbt_project_with_runtime_manifest( monkeypatch: pytest.MonkeyPatch, tmp_path: Path, dbt_project_dir: Path, @@ -155,17 +155,48 @@ def test_project_scaffold_command_with_runtime_manifest( use_dbt_project_package_data_dir=use_dbt_project_package_data_dir, ) - if use_experimental_dbt_project: - # DbtProject does not support opt in env var anymore - monkeypatch.setenv("DAGSTER_IS_DEV_CLI", "1") - else: - monkeypatch.setenv("DAGSTER_DBT_PARSE_PROJECT_ON_LOAD", "1") + monkeypatch.setenv("DAGSTER_DBT_PARSE_PROJECT_ON_LOAD", "1") monkeypatch.chdir(tmp_path) sys.path.append(os.fspath(tmp_path)) _assert_scaffold_defs(project_name=project_name, dagster_project_dir=dagster_project_dir) +@pytest.mark.parametrize("use_experimental_dbt_project", [True]) +@pytest.mark.parametrize("use_dbt_project_package_data_dir", [True, False]) +def test_project_scaffold_command_with_dbt_project_with_runtime_manifest( + monkeypatch: pytest.MonkeyPatch, + tmp_path: Path, + dbt_project_dir: Path, + use_dbt_project_package_data_dir: bool, + use_experimental_dbt_project: bool, +) -> None: + monkeypatch.chdir(tmp_path) + + project_name = f"test_dagster_scaffold_runtime_manifest_{use_experimental_dbt_project}" + dagster_project_dir = tmp_path.joinpath(project_name) + + _assert_scaffold_invocation( + project_name=project_name, + dbt_project_dir=dbt_project_dir, + dagster_project_dir=dagster_project_dir, + use_dbt_project_package_data_dir=use_dbt_project_package_data_dir, + use_experimental_dbt_project=use_experimental_dbt_project, + ) + + dbt_project_dir = _update_dbt_project_path( + dbt_project_dir=dbt_project_dir, + dagster_project_dir=dagster_project_dir, + use_dbt_project_package_data_dir=use_dbt_project_package_data_dir, + ) + + # DbtProject does not support the opt in env var anymore, only the local dev env var + monkeypatch.setenv("DAGSTER_IS_DEV_CLI", "1") + monkeypatch.chdir(tmp_path) + sys.path.append(os.fspath(tmp_path)) + + _assert_scaffold_defs(project_name=project_name, dagster_project_dir=dagster_project_dir) + @pytest.mark.parametrize("use_experimental_dbt_project", [True, False]) @pytest.mark.parametrize("use_dbt_project_package_data_dir", [True, False]) def test_project_scaffold_command_with_runtime_manifest_without_env_var( @@ -198,11 +229,8 @@ def test_project_scaffold_command_with_runtime_manifest_without_env_var( sys.path.append(os.fspath(tmp_path)) with pytest.raises(DagsterDbtManifestNotFoundError): - if use_experimental_dbt_project: - # DbtProject does not support opt in env var anymore - monkeypatch.delenv("DAGSTER_IS_DEV_CLI", raising=False) - else: - monkeypatch.delenv("DAGSTER_DBT_PARSE_PROJECT_ON_LOAD", raising=False) + monkeypatch.delenv("DAGSTER_DBT_PARSE_PROJECT_ON_LOAD", raising=False) + monkeypatch.delenv("DAGSTER_IS_DEV_CLI", raising=False) importlib.import_module(f"{project_name}.{project_name}.definitions")