From ff2f9fd5ee73580f5aa00108be575020c41f2511 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Sat, 24 Jan 2026 12:28:33 -0800 Subject: [PATCH] Add an additional test and "fix" code coverage (#1242). --- borgmatic/execute.py | 2 +- tests/unit/test_execute.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/borgmatic/execute.py b/borgmatic/execute.py index ae6309ee..a03015d9 100644 --- a/borgmatic/execute.py +++ b/borgmatic/execute.py @@ -222,7 +222,7 @@ def read_lines(buffer, process, line_separator='\n'): if not chunk: # EOF # The process is still running, so we keep running too. - if process.poll() is None: + if process.poll() is None: # pragma: no cover continue break diff --git a/tests/unit/test_execute.py b/tests/unit/test_execute.py index 8eb727c9..dcc105f1 100644 --- a/tests/unit/test_execute.py +++ b/tests/unit/test_execute.py @@ -302,6 +302,13 @@ def test_handle_log_record_over_max_line_count_trims_and_appends(): assert last_lines == [*original_last_lines[1:], 'line'] +def test_handle_log_record_without_last_lines_just_handles(): + flexmock(module.logger).should_receive('handle').once() + log_record = flexmock(levelno=module.logging.INFO, getMessage=lambda: 'line') + + assert module.handle_log_record(log_record) == log_record + + def test_log_buffer_lines_without_buffer_readers_bails(): flexmock(module.select).should_receive('select').never()