Skip to content

Commit

Permalink
Convert set_required_mocks of TestGetFullManifest into a fixture
Browse files Browse the repository at this point in the history
This wasn't working before, but it does now. Not sure why.
  • Loading branch information
QMalcolm committed May 15, 2024
1 parent 184fe9a commit 16edcbb
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions tests/unit/parser/test_manifest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from argparse import Namespace
from unittest.mock import MagicMock, patch

import pytest
from pytest_mock import MockerFixture

from dbt.config import RuntimeConfig
Expand Down Expand Up @@ -82,6 +83,7 @@ def test_partial_parse_safe_update_project_parser_files_partially(


class TestGetFullManifest:
@pytest.fixture
def set_required_mocks(
self, mocker: MockerFixture, manifest: Manifest, mock_adapter: MagicMock
):
Expand All @@ -95,12 +97,10 @@ def set_required_mocks(

def test_write_perf_info(
self,
manifest: Manifest,
mock_project: MagicMock,
mock_adapter: MagicMock,
mocker: MockerFixture,
set_required_mocks,
) -> None:
self.set_required_mocks(mocker, manifest, mock_adapter)
write_perf_info = mocker.patch("dbt.parser.manifest.ManifestLoader.write_perf_info")

ManifestLoader.get_full_manifest(
Expand All @@ -117,12 +117,10 @@ def test_write_perf_info(

def test_reset(
self,
manifest: Manifest,
mock_project: MagicMock,
mock_adapter: MagicMock,
mocker: MockerFixture,
set_required_mocks,
) -> None:
self.set_required_mocks(mocker, manifest, mock_adapter)

ManifestLoader.get_full_manifest(
config=mock_project,
Expand All @@ -141,12 +139,10 @@ def test_reset(

def test_partial_parse_file_diff_flag(
self,
manifest: Manifest,
mock_project: MagicMock,
mock_adapter: MagicMock,
mocker: MockerFixture,
set_required_mocks,
) -> None:
self.set_required_mocks(mocker, manifest, mock_adapter)

# FileDiff.from_dict is only called if PARTIAL_PARSE_FILE_DIFF == False
# So we can track this function call to check if setting PARTIAL_PARSE_FILE_DIFF
Expand Down

0 comments on commit 16edcbb

Please sign in to comment.