Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add test
  • Loading branch information
ChenyuLInx committed Jul 7, 2023
commit c89ad779714514cbceceed1bed13c403bb8ec03e
22 changes: 21 additions & 1 deletion tests/unit/test_parse_manifest.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import unittest
from unittest import mock
from unittest.mock import patch
from unittest.mock import patch, MagicMock
from argparse import Namespace

from .utils import config_from_parts_or_dicts, normalize

from dbt.contracts.files import SourceFile, FileHash, FilePath
from dbt.contracts.graph.manifest import Manifest, ManifestStateCheck
from dbt.parser import manifest
from dbt.parser.manifest import ManifestLoader
from dbt.config import RuntimeConfig
from dbt.flags import set_from_args


class MatchingHash(FileHash):
Expand Down Expand Up @@ -99,3 +103,19 @@ def _new_file(self, searched, name, match):
project_root=normalize(self.root_project_config.project_root),
)
return SourceFile(path=path, checksum=checksum)


class TestPartialParse(unittest.TestCase):
@patch("dbt.parser.manifest.ManifestLoader.build_manifest_state_check")
@patch("dbt.parser.manifest.os.path.exists")
def test_partial_parse_file_path(self, patched_os_exist, patched_state_check):
mock_project = MagicMock(RuntimeConfig)
mock_project.project_target_path = "mock_target_path"
set_from_args(Namespace(), {})
ManifestLoader(mock_project, {})
# by default we use the project_target_path
patched_os_exist.assert_called_with("mock_target_path/partial_parse.msgpack")
set_from_args(Namespace(partial_parse_file_path="specified_partial_parse_path"), {})
ManifestLoader(mock_project, {})
# if specified in flags, we use the specified path
patched_os_exist.assert_called_with("specified_partial_parse_path")