1212 SeaDatabricksClient ,
1313 _filter_session_configuration ,
1414)
15+ from databricks .sql .backend .sea .models .base import ServiceError , StatementStatus
1516from databricks .sql .backend .types import SessionId , CommandId , CommandState , BackendType
1617from databricks .sql .parameters .native import IntegerParameter , TDbsqlParameter
1718from databricks .sql .thrift_api .TCLIService import ttypes
@@ -408,7 +409,7 @@ def test_command_execution_advanced(
408409 async_op = False ,
409410 enforce_embedded_schema_correctness = False ,
410411 )
411- assert "Command test-statement-123 failed" in str (excinfo .value )
412+ assert "Command failed" in str (excinfo .value )
412413
413414 # Test missing statement ID
414415 mock_http_client .reset_mock ()
@@ -530,18 +531,18 @@ def test_check_command_state(self, sea_client, sea_command_id):
530531 """Test _check_command_not_in_failed_or_closed_state method."""
531532 # Test with RUNNING state (should not raise)
532533 sea_client ._check_command_not_in_failed_or_closed_state (
533- CommandState .RUNNING , sea_command_id
534+ StatementStatus ( state = CommandState .RUNNING ) , sea_command_id
534535 )
535536
536537 # Test with SUCCEEDED state (should not raise)
537538 sea_client ._check_command_not_in_failed_or_closed_state (
538- CommandState .SUCCEEDED , sea_command_id
539+ StatementStatus ( state = CommandState .SUCCEEDED ) , sea_command_id
539540 )
540541
541542 # Test with CLOSED state (should raise DatabaseError)
542543 with pytest .raises (DatabaseError ) as excinfo :
543544 sea_client ._check_command_not_in_failed_or_closed_state (
544- CommandState .CLOSED , sea_command_id
545+ StatementStatus ( state = CommandState .CLOSED ) , sea_command_id
545546 )
546547 assert "Command test-statement-123 unexpectedly closed server side" in str (
547548 excinfo .value
@@ -550,9 +551,13 @@ def test_check_command_state(self, sea_client, sea_command_id):
550551 # Test with FAILED state (should raise ServerOperationError)
551552 with pytest .raises (ServerOperationError ) as excinfo :
552553 sea_client ._check_command_not_in_failed_or_closed_state (
553- CommandState .FAILED , sea_command_id
554+ StatementStatus (
555+ state = CommandState .FAILED ,
556+ error = ServiceError (message = "Test error" , error_code = "TEST_ERROR" ),
557+ ),
558+ sea_command_id ,
554559 )
555- assert "Command test-statement-123 failed" in str (excinfo .value )
560+ assert "Command failed" in str (excinfo .value )
556561
557562 def test_utility_methods (self , sea_client ):
558563 """Test utility methods."""
0 commit comments