From 16edcbb8f8d973e7cea9cceea23f7e8d58c61165 Mon Sep 17 00:00:00 2001 From: Quigley Malcolm Date: Tue, 14 May 2024 17:05:53 -0700 Subject: [PATCH] Convert `set_required_mocks` of `TestGetFullManifest` into a fixture This wasn't working before, but it does now. Not sure why. --- tests/unit/parser/test_manifest.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/tests/unit/parser/test_manifest.py b/tests/unit/parser/test_manifest.py index 7da3f3aeece..b7d470a3552 100644 --- a/tests/unit/parser/test_manifest.py +++ b/tests/unit/parser/test_manifest.py @@ -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 @@ -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 ): @@ -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( @@ -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, @@ -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