@@ -105,16 +105,12 @@ def test_closing_connection_closes_commands(self, mock_thrift_client_class):
105105
106106 # Mock the execute response with controlled state
107107 mock_execute_response = Mock (spec = ExecuteResponse )
108-
109- mock_execute_response .command_id = Mock (spec = CommandId )
110- mock_execute_response .status = (
111- CommandState .SUCCEEDED if not closed else CommandState .CLOSED
112- )
108+ mock_execute_response .status = initial_state
113109 mock_execute_response .has_been_closed_server_side = closed
114110 mock_execute_response .is_staging_operation = False
115111 mock_execute_response .command_id = Mock (spec = CommandId )
116112
117- # Mock the backend that will be used by the real ThriftResultSet
113+ # Mock the backend that will be used
118114 mock_backend = Mock (spec = ThriftDatabricksClient )
119115 mock_backend .staging_allowed_local_path = None
120116 mock_backend .fetch_results .return_value = (Mock (), False )
@@ -135,14 +131,13 @@ def test_closing_connection_closes_commands(self, mock_thrift_client_class):
135131 # Mock execute_command to return our real result set
136132 cursor .backend .execute_command = Mock (return_value = real_result_set )
137133
138- # Execute a command - this should set cursor.active_result_set to our real result set
134+ # Execute a command
139135 cursor .execute ("SELECT 1" )
140136
141- # Close the connection - this should trigger the real close chain:
142- # connection.close() -> cursor.close() -> result_set.close()
137+ # Close the connection
143138 connection .close ()
144139
145- # Verify the REAL close logic worked through the chain :
140+ # Verify the close logic worked:
146141 # 1. has_been_closed_server_side should always be True after close()
147142 assert real_result_set .has_been_closed_server_side is True
148143
0 commit comments