diff --git a/tests/unit/test_log_streamer.py b/tests/unit/test_log_streamer.py index 185f49bb14ab..4301e8d6cfd0 100644 --- a/tests/unit/test_log_streamer.py +++ b/tests/unit/test_log_streamer.py @@ -1,5 +1,5 @@ import unittest -from unittest.mock import Mock, patch +from unittest.mock import Mock from openhands.runtime.utils.log_streamer import LogStreamer @@ -11,12 +11,14 @@ def setUp(self): def test_init_failure_handling(self): """Test that LogStreamer handles initialization failures gracefully.""" - self.mock_container.logs.side_effect = Exception("Test error") + self.mock_container.logs.side_effect = Exception('Test error') streamer = LogStreamer(self.mock_container, self.mock_log_fn) self.assertIsNone(streamer.stdout_thread) self.assertIsNone(streamer.log_generator) - self.mock_log_fn.assert_called_with('error', 'Failed to initialize log streaming: Test error') + self.mock_log_fn.assert_called_with( + 'error', 'Failed to initialize log streaming: Test error' + ) def test_stream_logs_without_generator(self): """Test that _stream_logs handles missing log generator gracefully.""" @@ -46,8 +48,10 @@ def test_normal_operation(self): # Verify logs were processed expected_calls = [ ('debug', '[inside container] test log 1'), - ('debug', '[inside container] test log 2') + ('debug', '[inside container] test log 2'), + ] + actual_calls = [ + (args[0], args[1]) for args, _ in self.mock_log_fn.call_args_list ] - actual_calls = [(args[0], args[1]) for args, _ in self.mock_log_fn.call_args_list] for expected in expected_calls: self.assertIn(expected, actual_calls)