From 1183d45c5065ec2baffc65d4f7935c9595e33700 Mon Sep 17 00:00:00 2001 From: txoof-bot <337660340+txoof-bot@users.noreply.github.com> Date: Mon, 9 Nov 2026 20:03:56 +0100 Subject: [PATCH] Health test: compare the report with its first size, not a fixed 200 bytes The report line is about 199-200 bytes and its length changes with the process number and other numbers, so the old fixed limit failed now and then. Co-Authored-By: Claude Opus 5.5 --- tests/test_health.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_health.py b/tests/test_health.py index 44aad88f..9aa81d68 100644 --- a/tests/test_health.py +++ b/tests/test_health.py @@ -146,10 +146,14 @@ def test_health_values_go_to_the_log_at_the_start_and_then_every_hour(tmp_path, def test_report_is_replaced_and_never_grows(tmp_path, systemd): path = tmp_path / "health" reports = Health(path, disk=tmp_path, notify=systemd) - for _ in range(200): + reports.report(None) + first = path.stat().st_size + for _ in range(199): reports.report(None) assert len(path.read_text().splitlines()) == 1 - assert path.stat().st_size < 200 + # About the same size as one report: the numbers in it (memory, free disk) may change + # by a few digits between reports, so no exact size. + assert path.stat().st_size <= first + 10 assert [p.name for p in tmp_path.iterdir()] == ["health"] # no temporary files left