SIENTIAPDE-1579: Fix SientiaMlException propagation in ModelServing.search_runs_by_name to correctly raise the exception with its message, resolving a TypeError. Enhance training test script to support scenario-specific CSV files for different test cases. Update search_runs_by_name return type hint and apply minor code formatting.
This commit is contained in:
@@ -112,18 +112,16 @@ def test_search_runs_by_name_with_order_by(mock_search_runs, mock_set_tracking_u
|
||||
def test_search_runs_by_name_raises_exception(
|
||||
mock_logging_error, mock_search_runs, mock_set_tracking_uri
|
||||
):
|
||||
"""Test search_runs_by_name raises TypeError due to bug in line 80 of model_serving.py."""
|
||||
"""Test search_runs_by_name properly propagates SientiaMlException."""
|
||||
model_serving = ModelServing(tracking_uri='http://mlflow.example.com')
|
||||
|
||||
exception = SientiaMlException(message='Search failed')
|
||||
mock_search_runs.side_effect = exception
|
||||
|
||||
# The code has a bug on line 80: "raise SientiaMlException from e"
|
||||
# This raises TypeError because SientiaMlException requires 'message' argument
|
||||
with raises(TypeError, match="missing 1 required positional argument: 'message'"):
|
||||
with raises(SientiaMlException, match='Search failed'):
|
||||
model_serving.search_runs_by_name(['experiment1'])
|
||||
|
||||
mock_logging_error.assert_called_once()
|
||||
mock_logging_error.assert_called_once_with(exception)
|
||||
|
||||
|
||||
@patch('model_manager.sientia.model_serving.mlflow.set_tracking_uri')
|
||||
|
||||
Reference in New Issue
Block a user