Skip to content

Commit edc36b5

Browse files
better mocked backend naming
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 55f5c45 commit edc36b5

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

tests/unit/test_thrift_backend.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def _create_fake_thrift_client(self):
117117
ssl_options=SSLOptions(),
118118
)
119119

120-
def _make_fake_thrift_backend(self):
120+
def _create_mocked_thrift_client(self):
121121
"""Create a fake ThriftDatabricksClient with mocked methods."""
122122
thrift_backend = self._create_fake_thrift_client()
123123
thrift_backend._hive_schema_to_arrow_schema = Mock()
@@ -184,7 +184,7 @@ def test_bad_protocol_versions_are_rejected(self, tcli_service_client_cass):
184184
)
185185

186186
with self.assertRaises(OperationalError) as cm:
187-
thrift_backend = self._make_fake_thrift_backend()
187+
thrift_backend = self._create_mocked_thrift_client()
188188
thrift_backend.open_session({}, None, None)
189189

190190
self.assertIn(
@@ -207,7 +207,7 @@ def test_okay_protocol_versions_succeed(self, tcli_service_client_cass):
207207
sessionHandle=self.session_handle,
208208
)
209209

210-
thrift_backend = self._make_fake_thrift_backend()
210+
thrift_backend = self._create_mocked_thrift_client()
211211
thrift_backend.open_session({}, None, None)
212212

213213
@patch("databricks.sql.auth.thrift_http_client.THttpClient")
@@ -917,7 +917,7 @@ def test_handle_execute_response_can_handle_with_direct_results(self):
917917
operationHandle=self.operation_handle,
918918
)
919919

920-
thrift_backend = self._make_fake_thrift_backend()
920+
thrift_backend = self._create_mocked_thrift_client()
921921
mock_execute_response = Mock(spec=ExecuteResponse)
922922
mock_has_more_rows = True
923923
thrift_backend._results_message_to_execute_response = Mock(
@@ -1100,7 +1100,7 @@ def test_handle_execute_response_reads_has_more_rows_in_result_response(
11001100
tcli_service_instance.GetResultSetMetadata.return_value = (
11011101
self.metadata_resp
11021102
)
1103-
thrift_backend = self._make_fake_thrift_backend()
1103+
thrift_backend = self._create_mocked_thrift_client()
11041104

11051105
thrift_backend._handle_execute_response(execute_resp, Mock())
11061106
_, has_more_rows_resp = thrift_backend.fetch_results(
@@ -1221,7 +1221,7 @@ def test_get_catalogs_calls_client_and_handle_execute_response(
12211221
tcli_service_instance = tcli_service_class.return_value
12221222
response = Mock()
12231223
tcli_service_instance.GetCatalogs.return_value = response
1224-
thrift_backend = self._make_fake_thrift_backend()
1224+
thrift_backend = self._create_mocked_thrift_client()
12251225

12261226
mock_execute_response = self._create_mock_execute_response()
12271227
mock_has_more_rows = True
@@ -1255,7 +1255,7 @@ def test_get_schemas_calls_client_and_handle_execute_response(
12551255
tcli_service_instance = tcli_service_class.return_value
12561256
response = Mock()
12571257
tcli_service_instance.GetSchemas.return_value = response
1258-
thrift_backend = self._make_fake_thrift_backend()
1258+
thrift_backend = self._create_mocked_thrift_client()
12591259
mock_execute_response = self._create_mock_execute_response()
12601260
mock_has_more_rows = True
12611261
thrift_backend._handle_execute_response = Mock(
@@ -1297,7 +1297,7 @@ def test_get_tables_calls_client_and_handle_execute_response(
12971297
tcli_service_instance = tcli_service_class.return_value
12981298
response = Mock()
12991299
tcli_service_instance.GetTables.return_value = response
1300-
thrift_backend = self._make_fake_thrift_backend()
1300+
thrift_backend = self._create_mocked_thrift_client()
13011301
mock_execute_response = self._create_mock_execute_response()
13021302
mock_has_more_rows = True
13031303
thrift_backend._handle_execute_response = Mock(
@@ -1343,7 +1343,7 @@ def test_get_columns_calls_client_and_handle_execute_response(
13431343
tcli_service_instance = tcli_service_class.return_value
13441344
response = Mock()
13451345
tcli_service_instance.GetColumns.return_value = response
1346-
thrift_backend = self._make_fake_thrift_backend()
1346+
thrift_backend = self._create_mocked_thrift_client()
13471347
mock_execute_response = self._create_mock_execute_response()
13481348
mock_has_more_rows = True
13491349
thrift_backend._handle_execute_response = Mock(
@@ -1655,7 +1655,7 @@ def test_convert_column_based_set_to_arrow_table_uses_types_from_col_set(self):
16551655
def test_cancel_command_uses_active_op_handle(self, tcli_service_class):
16561656
tcli_service_instance = tcli_service_class.return_value
16571657

1658-
thrift_backend = self._make_fake_thrift_backend()
1658+
thrift_backend = self._create_mocked_thrift_client()
16591659
# Create a proper CommandId from the existing operation_handle
16601660
command_id = CommandId.from_thrift_handle(self.operation_handle)
16611661
thrift_backend.cancel_command(command_id)
@@ -1666,7 +1666,7 @@ def test_cancel_command_uses_active_op_handle(self, tcli_service_class):
16661666
)
16671667

16681668
def test_handle_execute_response_sets_active_op_handle(self):
1669-
thrift_backend = self._make_fake_thrift_backend()
1669+
thrift_backend = self._create_mocked_thrift_client()
16701670
thrift_backend._check_direct_results_for_error = Mock()
16711671
thrift_backend._wait_until_command_done = Mock()
16721672
mock_execute_response = Mock(spec=ExecuteResponse)

0 commit comments

Comments
 (0)