-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Repository unit tests for
ManifestLoader.get_full_manifest
(#10147)
* Add test for different `write_perf_info` values to `get_full_manifest` * Add test for different `reset` values to `get_full_manifest` * Abstract required mocks for `get_full_manifest` tests to reduce duplication There are a set of required mocks that `get_full_manifest` unit tests need. Instead of doing these mocks in each test, we've abstracted these mocks into a reusable function. I did try to do this as a fixture, but for some reaosn the mocks didn't actually propagate when I did that. * Add test for different `PARTIAL_PARSE_FILE_DIFF` values to `get_full_manifest` * Refactor mock fixtures in `test_manifest.py` to make them more widely available * Convert `set_required_mocks` of `TestGetFullManifest` into a fixture This wasn't working before, but it does now. Not sure why.
- Loading branch information
Showing
4 changed files
with
124 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from unittest.mock import MagicMock | ||
|
||
import pytest | ||
|
||
from dbt.adapters.postgres import PostgresAdapter | ||
from dbt.adapters.sql import SQLConnectionManager | ||
|
||
|
||
@pytest.fixture | ||
def mock_connection_manager() -> MagicMock: | ||
mock_connection_manager = MagicMock(SQLConnectionManager) | ||
mock_connection_manager.set_query_header = lambda query_header_context: None | ||
return mock_connection_manager | ||
|
||
|
||
@pytest.fixture | ||
def mock_adapter(mock_connection_manager: MagicMock) -> MagicMock: | ||
mock_adapter = MagicMock(PostgresAdapter) | ||
mock_adapter.connections = mock_connection_manager | ||
mock_adapter.clear_macro_resolver = MagicMock() | ||
return mock_adapter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters