Skip to content

Commit

Permalink
Add test for different PARTIAL_PARSE_FILE_DIFF values to `get_full_…
Browse files Browse the repository at this point in the history
…manifest`
  • Loading branch information
QMalcolm committed May 14, 2024
1 parent 791ec1d commit 8dc4228
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/unit/parser/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from dbt.contracts.graph.manifest import Manifest
from dbt.flags import set_from_args
from dbt.parser.manifest import ManifestLoader
from dbt.parser.read_files import FileDiff
from dbt.tracking import User


Expand Down Expand Up @@ -170,3 +171,30 @@ def test_reset(
ManifestLoader.get_full_manifest(config=mock_project, reset=True)
assert mock_project.clear_dependencies.called
assert mock_adapter.clear_macro_resolver.called

def test_partial_parse_file_diff_flag(
self,
manifest: Manifest,
mock_project: MagicMock,
mock_adapter: MagicMock,
mocker: MockerFixture,
) -> 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
# works appropriately
mock_file_diff = mocker.patch("dbt.parser.read_files.FileDiff.from_dict")
mock_file_diff.return_value = FileDiff([], [], [])

set_from_args(Namespace(), {})
ManifestLoader.get_full_manifest(config=mock_project)
assert not mock_file_diff.called

set_from_args(Namespace(PARTIAL_PARSE_FILE_DIFF=True), {})
ManifestLoader.get_full_manifest(config=mock_project)
assert not mock_file_diff.called

set_from_args(Namespace(PARTIAL_PARSE_FILE_DIFF=False), {})
ManifestLoader.get_full_manifest(config=mock_project)
assert mock_file_diff.called

0 comments on commit 8dc4228

Please sign in to comment.