Skip to content

Commit

Permalink
split scaffold test
Browse files Browse the repository at this point in the history
  • Loading branch information
maximearmstrong committed Jun 27, 2024
1 parent f5b0b22 commit 34087d8
Showing 1 changed file with 40 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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(
Expand Down Expand Up @@ -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")


Expand Down

0 comments on commit 34087d8

Please sign in to comment.