Skip to content

Commit

Permalink
unittests fix
Browse files Browse the repository at this point in the history
  • Loading branch information
haritamar committed Jul 3, 2024
1 parent 957dd32 commit 67a36e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 3 additions & 3 deletions tests/unit/clients/dbt_runner/test_dbt_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import pytest

from elementary.clients.dbt.factory import create_dbt_runner
from elementary.clients.dbt.subprocess_dbt_runner import SubprocessDbtRunner


@pytest.mark.parametrize(
Expand All @@ -18,7 +18,7 @@
def test_dbt_runner_seed(mock_subprocess_run, command):
project_dir = "proj_dir"
profiles_dir = "prof_dir"
dbt_runner = create_dbt_runner(project_dir=project_dir, profiles_dir=profiles_dir)
dbt_runner = SubprocessDbtRunner(project_dir=project_dir, profiles_dir=profiles_dir)
if command == "seed":
dbt_runner.seed()
elif command == "snapshot":
Expand Down Expand Up @@ -49,7 +49,7 @@ def test_dbt_runner_run(mock_subprocess_run, model, full_refresh, dbt_vars):
project_dir = "proj_dir"
profiles_dir = "prof_dir"
expanded_dbt_vars = json.dumps(dbt_vars)
dbt_runner = create_dbt_runner(project_dir=project_dir, profiles_dir=profiles_dir)
dbt_runner = SubprocessDbtRunner(project_dir=project_dir, profiles_dir=profiles_dir)
dbt_runner.run(model, full_refresh=full_refresh, vars=dbt_vars)
mock_subprocess_run.assert_called()
if model is not None:
Expand Down
8 changes: 6 additions & 2 deletions tests/unit/monitor/data_monitoring/test_selector_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,17 @@ def anonymous_tracking_mock() -> MockAnonymousTracking:

@pytest.fixture(scope="function")
def dbt_runner_no_models_mock() -> Generator[MagicMock, None, None]:
with patch("elementary.clients.dbt.dbt_runner.DbtRunner.ls") as mock_ls:
with patch(
"elementary.clients.dbt.command_line_dbt_runner.CommandLineDbtRunner.ls"
) as mock_ls:
mock_ls.return_value = []
yield mock_ls


@pytest.fixture(scope="function")
def dbt_runner_with_models_mock() -> Generator[MagicMock, None, None]:
with patch("elementary.clients.dbt.dbt_runner.DbtRunner.ls") as mock_ls:
with patch(
"elementary.clients.dbt.command_line_dbt_runner.CommandLineDbtRunner.ls"
) as mock_ls:
mock_ls.return_value = ["node_name_1", "node_name_2"]
yield mock_ls

0 comments on commit 67a36e9

Please sign in to comment.