From fbdf9c3c6c937a6b135a2a596283f71f4f5bfc1e Mon Sep 17 00:00:00 2001 From: vitor-aignosi Date: Tue, 5 Aug 2025 14:19:53 -0300 Subject: [PATCH] SIENTIAPDE-1174 SIENTIAPDE-1174 Update tests to enhance MLFlow and workflow activity assertions - Added logger initialization in MLFlowRepository for improved logging. - Updated prediction test assertions to reflect changes in output structure. - Increased activity method call count assertions in workflow tests for accuracy. --- tests/laborious/activities/test_mlflow.py | 2 +- tests/laborious/utils/repository/test_model_repository.py | 7 +++++-- .../subworkflows/test_format_and_export_prediction.py | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/laborious/activities/test_mlflow.py b/tests/laborious/activities/test_mlflow.py index 8995157..fc80f5a 100644 --- a/tests/laborious/activities/test_mlflow.py +++ b/tests/laborious/activities/test_mlflow.py @@ -24,7 +24,7 @@ def test___init__(mock_mlflow_repository): assert mlflow.mlflow_password == "admin" mock_mlflow_repository.assert_called_once_with( - "http://localhost:5000", "admin", "admin" + "http://localhost:5000", "admin", "admin", ANY ) diff --git a/tests/laborious/utils/repository/test_model_repository.py b/tests/laborious/utils/repository/test_model_repository.py index 62f4fc3..29cbe5c 100644 --- a/tests/laborious/utils/repository/test_model_repository.py +++ b/tests/laborious/utils/repository/test_model_repository.py @@ -16,7 +16,8 @@ def mlflow_repository(): repo = MLFlowRepository( host='http://localhost:5000', username='admin', - password='admin' + password='admin', + logger=MagicMock() ) return repo @@ -71,7 +72,9 @@ def test_predict_success(mlflow_repository): assert output['success'] is True assert output['content'] == {'prediction': { - 0: 3}, 'response_time': ANY} + 0: 2, + 1: 3 + }, 'response_time': ANY} def test_predict_error(mlflow_repository): diff --git a/tests/laborious/workflows/subworkflows/test_format_and_export_prediction.py b/tests/laborious/workflows/subworkflows/test_format_and_export_prediction.py index 7dbf39a..648a38f 100644 --- a/tests/laborious/workflows/subworkflows/test_format_and_export_prediction.py +++ b/tests/laborious/workflows/subworkflows/test_format_and_export_prediction.py @@ -79,7 +79,7 @@ async def test_run_none_path_flag(workflow_mock, format_and_export_prediction): start_to_close_timeout=ANY )]) - assert workflow_mock.execute_activity_method.call_count == 2 + assert workflow_mock.execute_activity_method.call_count == 3 assert workflow_mock.execute_local_activity_method.call_count == 1 @@ -145,5 +145,5 @@ async def test_run_default_path_flag(workflow_mock, format_and_export_prediction ) ]) - assert workflow_mock.execute_activity_method.call_count == 2 + assert workflow_mock.execute_activity_method.call_count == 3 assert workflow_mock.execute_local_activity_method.call_count == 1