Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2a26965

Browse files
committed
removed the changes in test_client and test_fetches
Signed-off-by: Sai Shree Pradhan <[email protected]>
1 parent 142b9a8 commit 2a26965

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

tests/unit/test_client.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ def new(cls):
3838
cls.apply_property_to_mock(ThriftBackendMock, staging_allowed_local_path=None)
3939
MockTExecuteStatementResp = MagicMock(spec=TExecuteStatementResp())
4040

41-
mock_retry_policy = Mock()
42-
mock_retry_policy.history = []
43-
cls.apply_property_to_mock(ThriftBackendMock, retry_policy=mock_retry_policy)
44-
4541
cls.apply_property_to_mock(
4642
MockTExecuteStatementResp,
4743
description=None,
@@ -322,7 +318,7 @@ def test_executing_multiple_commands_uses_the_most_recent_command(
322318
mock_result_sets[1].fetchall.assert_called_once_with()
323319

324320
def test_closed_cursor_doesnt_allow_operations(self):
325-
cursor = client.Cursor(Mock(), ThriftBackendMockFactory.new())
321+
cursor = client.Cursor(Mock(), Mock())
326322
cursor.close()
327323

328324
with self.assertRaises(Error) as e:
@@ -334,19 +330,14 @@ def test_closed_cursor_doesnt_allow_operations(self):
334330
self.assertIn("closed", e.msg)
335331

336332
def test_negative_fetch_throws_exception(self):
337-
mock_connection = Mock()
338-
mock_connection.get_session_id_hex.return_value = "test_session"
339-
mock_execute_response = Mock()
340-
mock_execute_response.command_handle = None
341-
342-
result_set = client.ResultSet(mock_connection, mock_execute_response, ThriftBackendMockFactory.new())
333+
result_set = client.ResultSet(Mock(), Mock(), Mock())
343334

344335
with self.assertRaises(ValueError) as e:
345336
result_set.fetchmany(-1)
346337

347338
def test_context_manager_closes_cursor(self):
348339
mock_close = Mock()
349-
with client.Cursor(Mock(), ThriftBackendMockFactory.new()) as cursor:
340+
with client.Cursor(Mock(), Mock()) as cursor:
350341
cursor.close = mock_close
351342
mock_close.assert_called_once_with()
352343

@@ -389,7 +380,7 @@ def test_get_schemas_parameters_passed_to_thrift_backend(self, mock_thrift_backe
389380
for req_args in req_args_combinations:
390381
req_args = {k: v for k, v in req_args.items() if v != "NOT_SET"}
391382
with self.subTest(req_args=req_args):
392-
mock_thrift_backend = ThriftBackendMockFactory.new()
383+
mock_thrift_backend = Mock()
393384

394385
cursor = client.Cursor(Mock(), mock_thrift_backend)
395386
cursor.schemas(**req_args)
@@ -412,7 +403,7 @@ def test_get_tables_parameters_passed_to_thrift_backend(self, mock_thrift_backen
412403
for req_args in req_args_combinations:
413404
req_args = {k: v for k, v in req_args.items() if v != "NOT_SET"}
414405
with self.subTest(req_args=req_args):
415-
mock_thrift_backend = ThriftBackendMockFactory.new()
406+
mock_thrift_backend = Mock()
416407

417408
cursor = client.Cursor(Mock(), mock_thrift_backend)
418409
cursor.tables(**req_args)
@@ -435,7 +426,7 @@ def test_get_columns_parameters_passed_to_thrift_backend(self, mock_thrift_backe
435426
for req_args in req_args_combinations:
436427
req_args = {k: v for k, v in req_args.items() if v != "NOT_SET"}
437428
with self.subTest(req_args=req_args):
438-
mock_thrift_backend = ThriftBackendMockFactory.new()
429+
mock_thrift_backend = Mock()
439430

440431
cursor = client.Cursor(Mock(), mock_thrift_backend)
441432
cursor.columns(**req_args)

tests/unit/test_fetches.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ def fetch_results(
8080
return results, batch_index < len(batch_list)
8181

8282
mock_thrift_backend = Mock()
83-
mock_retry_policy = Mock()
84-
mock_retry_policy.history = []
85-
mock_thrift_backend.retry_policy = mock_retry_policy
8683
mock_thrift_backend.fetch_results = fetch_results
8784
num_cols = len(batch_list[0][0]) if batch_list and batch_list[0] else 0
8885

0 commit comments

Comments
 (0)