diff --git a/src/test_workflow/test_recorder/test_recorder.py b/src/test_workflow/test_recorder/test_recorder.py index 5afed60568..64da8643aa 100644 --- a/src/test_workflow/test_recorder/test_recorder.py +++ b/src/test_workflow/test_recorder/test_recorder.py @@ -142,6 +142,7 @@ def save_test_result_data(self, test_result_data: TestResultData) -> None: class TestResultsLogs(LogRecorder): + __test__ = False # type:ignore parent_class: TestRecorder def __init__(self, parent_class: TestRecorder) -> None: diff --git a/tests/tests_test_workflow/test_recorder/test_test_recorder.py b/tests/tests_test_workflow/test_recorder/test_test_recorder.py index 245afbe41f..faf93a9948 100644 --- a/tests/tests_test_workflow/test_recorder/test_test_recorder.py +++ b/tests/tests_test_workflow/test_recorder/test_test_recorder.py @@ -11,7 +11,7 @@ from typing import Any from unittest.mock import MagicMock, Mock, call, mock_open, patch -from test_workflow.test_recorder.test_recorder import LocalClusterLogs, TestRecorder +from test_workflow.test_recorder.test_recorder import LocalClusterLogs, TestRecorder, TestResultsLogs @patch("os.makedirs") @@ -146,3 +146,34 @@ def test(self) -> None: logs.save_test_result_data(mock_test_result_data) mock_parent_class._copy_log_files.assert_called_once_with(mock_test_result_data.log_files, dest_directory) + + +class TestTestResultsLogs(unittest.TestCase): + + def test(self) -> None: + mock_parent_class = MagicMock() + + mock_parent_class._create_base_folder_structure.return_value = "test_base" + + mock_parent_class._copy_log_files = MagicMock() + + logs = TestResultsLogs(mock_parent_class) + + mock_test_result_data = MagicMock() + + dest_directory = "test_base" + + source_file_1 = "stdout.txt" + source_file_2 = "stderr.txt" + + mock_test_result_data.log_files = { + source_file_1, + source_file_2 + } + mock_test_result_data.component_name = "sql" + mock_test_result_data.component_test_config = "with-security" + + logs.save_test_result_data(mock_test_result_data) + + mock_parent_class._copy_log_files.assert_called_once_with(mock_test_result_data.log_files, dest_directory) + mock_parent_class._generate_yml.assert_called_once_with(mock_test_result_data, dest_directory)