@@ -105,17 +105,13 @@ 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 mock_execute_response .description = []
117113
118- # Mock the backend that will be used by the real ThriftResultSet
114+ # Mock the backend that will be used
119115 mock_backend = Mock (spec = ThriftDatabricksClient )
120116 mock_backend .staging_allowed_local_path = None
121117 mock_backend .fetch_results .return_value = (Mock (), False , 0 )
@@ -137,15 +133,13 @@ def test_closing_connection_closes_commands(self, mock_thrift_client_class):
137133 # Mock execute_command to return our real result set
138134 cursor .backend .execute_command = Mock (return_value = real_result_set )
139135
140- # Execute a command - this should set cursor.active_result_set to our real result set
136+ # Execute a command
141137 cursor .execute ("SELECT 1" )
142138
143- # Close the connection - this should trigger the real close chain:
144- # connection.close() -> cursor.close() -> result_set.close()
139+ # Close the connection
145140 connection .close ()
146141
147- # Verify the REAL close logic worked through the chain:
148- # 1. has_been_closed_server_side should always be True after close()
142+ # Verify the close logic worked:
149143 assert real_result_set .has_been_closed_server_side is True
150144
151145 # 2. op_state should always be CLOSED after close()
0 commit comments