Skip to content

Commit 4148aac

Browse files
account for new exec resp
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent aba27ab commit 4148aac

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

tests/unit/test_client.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,8 @@ def test_closing_connection_closes_commands(self, mock_thrift_client_class):
121121

122122
# Verify initial state
123123
self.assertEqual(real_result_set.has_been_closed_server_side, closed)
124-
expected_op_state = (
125-
CommandState.CLOSED if closed else CommandState.SUCCEEDED
126-
)
127-
self.assertEqual(real_result_set.op_state, expected_op_state)
124+
expected_status = CommandState.CLOSED if closed else CommandState.SUCCEEDED
125+
self.assertEqual(real_result_set.status, expected_status)
128126

129127
# Mock execute_command to return our real result set
130128
cursor.backend.execute_command = Mock(return_value=real_result_set)
@@ -146,8 +144,8 @@ def test_closing_connection_closes_commands(self, mock_thrift_client_class):
146144
# 1. has_been_closed_server_side should always be True after close()
147145
self.assertTrue(real_result_set.has_been_closed_server_side)
148146

149-
# 2. op_state should always be CLOSED after close()
150-
self.assertEqual(real_result_set.op_state, CommandState.CLOSED)
147+
# 2. status should always be CLOSED after close()
148+
self.assertEqual(real_result_set.status, CommandState.CLOSED)
151149

152150
# 3. Backend close_command should be called appropriately
153151
if not closed:
@@ -556,7 +554,7 @@ def test_cursor_keeps_connection_alive(self, mock_client_class):
556554
self.assertEqual(instance.close_session.call_count, 0)
557555
cursor.close()
558556

559-
@patch("%s.utils.ExecuteResponse" % PACKAGE_NAME, autospec=True)
557+
@patch("%s.backend.types.ExecuteResponse" % PACKAGE_NAME)
560558
@patch("%s.client.Cursor._handle_staging_operation" % PACKAGE_NAME)
561559
@patch("%s.session.ThriftDatabricksClient" % PACKAGE_NAME)
562560
def test_staging_operation_response_is_handled(
@@ -678,7 +676,7 @@ def test_resultset_close_handles_cursor_already_closed_error(self):
678676
"""Test that ResultSet.close() handles CursorAlreadyClosedError properly."""
679677
result_set = client.ThriftResultSet.__new__(client.ThriftResultSet)
680678
result_set.backend = Mock()
681-
result_set.backend.CLOSED_OP_STATE = "CLOSED"
679+
result_set.backend.CLOSED_OP_STATE = CommandState.CLOSED
682680
result_set.connection = Mock()
683681
result_set.connection.open = True
684682
result_set.op_state = "RUNNING"

0 commit comments

Comments
 (0)