This repository was archived by the owner on Mar 31, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,4 +75,31 @@ def target_folder_path(request: FixtureRequest) -> str:
7575 defaulting to "tests/".
7676 """ # noqa: E501
7777 return request .config .getoption ("--target_folder_path" )
78- return request .config .getoption ("--target_folder_path" )
78+
79+
80+ @fixture (autouse = True )
81+ def mock_bigquery_client (mocker : FixtureRequest ) -> None :
82+ """Mock bigquery Client to prevent actual API calls during testing."""
83+ from unittest .mock import MagicMock
84+
85+ mock_client = mocker .patch ("dataform2looker.database_mappers.bigquery.Client" )
86+ mock_instance = mock_client .return_value
87+
88+ def get_table_side_effect (table_id : str ) -> MagicMock :
89+ mock_table = MagicMock ()
90+
91+ mock_field1 = MagicMock ()
92+ mock_field1 .name = "id"
93+ mock_field1 .description = "Primary Key"
94+ mock_field1 .field_type = "STRING"
95+
96+ mock_field2 = MagicMock ()
97+ mock_field2 .name = "created_at"
98+ mock_field2 .description = "Creation date"
99+ mock_field2 .field_type = "TIMESTAMP"
100+
101+ mock_table .schema = [mock_field1 , mock_field2 ]
102+ return mock_table
103+
104+ mock_instance .get_table .side_effect = get_table_side_effect
105+ return mock_instance
You can’t perform that action at this time.
0 commit comments