Skip to content

Commit 498fbcb

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent efaf256 commit 498fbcb

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

rsync_time_machine.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,9 @@ def deal_with_no_space_left(
702702
log_data,
703703
)
704704

705-
if not no_space_left and re.search(r"rsync: \[sender\] write error: Broken pipe \(32\)", log_data):
705+
if not no_space_left and re.search(
706+
r"rsync: \[sender\] write error: Broken pipe \(32\)", log_data,
707+
):
706708
df_result = run_cmd(f"df -Pk '{dest_folder}'", dest_is_ssh(ssh))
707709
if df_result.returncode == 0:
708710
lines = df_result.stdout.splitlines()

tests/test_app.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ def test_deal_with_no_space_left_handles_broken_pipe_when_dest_full(
206206
) -> None:
207207
"""Broken pipe with a full destination should trigger expiration."""
208208
log_file = tmp_path / "2025-10-12-212400.log"
209-
log_file.write_text("rsync: [sender] write error: Broken pipe (32)\n", encoding="utf-8")
209+
log_file.write_text(
210+
"rsync: [sender] write error: Broken pipe (32)\n", encoding="utf-8",
211+
)
210212

211213
backups = [
212214
"/dest/2025-10-11-120000",
@@ -222,7 +224,9 @@ def test_deal_with_no_space_left_handles_broken_pipe_when_dest_full(
222224
lambda path, ssh: expired.append(path),
223225
)
224226

225-
def fake_run_cmd(cmd: str, ssh: rsync_time_machine.SSH | None = None) -> rsync_time_machine.CmdResult:
227+
def fake_run_cmd(
228+
cmd: str, ssh: rsync_time_machine.SSH | None = None,
229+
) -> rsync_time_machine.CmdResult:
226230
if cmd.startswith("df -Pk"):
227231
df_output = (
228232
"Filesystem 1024-blocks Used Available Capacity Mounted on\n"
@@ -250,12 +254,20 @@ def test_deal_with_no_space_left_ignores_broken_pipe_when_space_available(
250254
) -> None:
251255
"""Broken pipe without the destination filling up should not expire backups."""
252256
log_file = tmp_path / "2025-10-12-212400.log"
253-
log_file.write_text("rsync: [sender] write error: Broken pipe (32)\n", encoding="utf-8")
257+
log_file.write_text(
258+
"rsync: [sender] write error: Broken pipe (32)\n", encoding="utf-8",
259+
)
254260

255-
monkeypatch.setattr(rsync_time_machine, "find_backups", Mock(return_value=["/dest/2025-10-12-120000", "/dest/2025-10-11-120000"]))
261+
monkeypatch.setattr(
262+
rsync_time_machine,
263+
"find_backups",
264+
Mock(return_value=["/dest/2025-10-12-120000", "/dest/2025-10-11-120000"]),
265+
)
256266
monkeypatch.setattr(rsync_time_machine, "expire_backup", Mock())
257267

258-
def fake_run_cmd(cmd: str, ssh: rsync_time_machine.SSH | None = None) -> rsync_time_machine.CmdResult:
268+
def fake_run_cmd(
269+
cmd: str, ssh: rsync_time_machine.SSH | None = None,
270+
) -> rsync_time_machine.CmdResult:
259271
if cmd.startswith("df -Pk"):
260272
df_output = (
261273
"Filesystem 1024-blocks Used Available Capacity Mounted on\n"

0 commit comments

Comments
 (0)