[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1109029: unblock: ledgerhelpers/0.3.10-3



Package: release.debian.org
Severity: normal
X-Debbugs-Cc: ledgerhelpers@packages.debian.org, porridge@debian.org
Control: affects -1 + src:ledgerhelpers
User: release.debian.org@packages.debian.org
Usertags: unblock

Please unblock package ledgerhelpers

[ Reason ]
Fix flaky FTBFS bug Bug#1108809.

[ Impact ]
Test suite Will sometimes fail, causing FTBFS (10%-50% chance depending
on machine).

[ Tests ]
The affected code IS a test.

[ Risks ]
Leaf package, simple well-tested change (see upstream PR link in the bug).
Alternative: disable or remove the flaky test altogether.

[ Checklist ]
  [x] all changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in testing

[ Other info ]
See https://github.com/Rudd-O/ledgerhelpers/pull/38 for the (pending)
upstream fix. The targeted fix for Debian omits the refactoring
mentioned below. Description pasted here for convenience:

> It turns out that most Linux file systems have high time stamp
> resolution but low granularity of actual timestamp values. This means
> that a file write done in quick succession after the previous one might
> not cause the st_mtime value to change.
> 
> This in turn means that the caching layer in this library will return
> stale content, causing this test to flake as described in
> https://github.com/Rudd-O/ledgerhelpers/issues/28#issuecomment-3038889660
> 
> As for the sleep duration, I tried 2 milliseconds at first, but then it
> failed after a few hundred runs. Without a sleep, it failed after a
> dozen or so runs. With 10ms it didn't fail even after a couple hundred
> thousand runs.
> 
> While at it, I also refactored the loading of transaction data into
> variables so that it's easier to grasp the intent of the test.

unblock ledgerhelpers/0.3.10-3
diff -Nru ledgerhelpers-0.3.10/debian/changelog ledgerhelpers-0.3.10/debian/changelog
--- ledgerhelpers-0.3.10/debian/changelog	2022-12-12 17:36:34.000000000 +0100
+++ ledgerhelpers-0.3.10/debian/changelog	2025-07-09 09:51:04.000000000 +0200
@@ -1,3 +1,9 @@
+ledgerhelpers (0.3.10-3) unstable; urgency=high
+
+  * De-flake test_reload_works. (Closes: Bug#1108809)
+
+ -- Marcin Owsiany <porridge@debian.org>  Wed, 09 Jul 2025 09:51:04 +0200
+
 ledgerhelpers (0.3.10-2) unstable; urgency=low
 
   * Re-add python3-setuptools build-depends, turns out it is necessary
diff -Nru ledgerhelpers-0.3.10/debian/patches/0002-De-flake-test_reload_works.patch ledgerhelpers-0.3.10/debian/patches/0002-De-flake-test_reload_works.patch
--- ledgerhelpers-0.3.10/debian/patches/0002-De-flake-test_reload_works.patch	1970-01-01 01:00:00.000000000 +0100
+++ ledgerhelpers-0.3.10/debian/patches/0002-De-flake-test_reload_works.patch	2025-07-09 09:51:04.000000000 +0200
@@ -0,0 +1,29 @@
+From: Marcin Owsiany <porridge@debian.org>
+Date: Wed, 9 Jul 2025 09:39:17 +0200
+Subject: De-flake test_reload_works.
+
+Closes: Bug#1108809
+---
+ tests/test_ledgerhelpers.py | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/tests/test_ledgerhelpers.py b/tests/test_ledgerhelpers.py
+index 4456db2..474b379 100644
+--- a/tests/test_ledgerhelpers.py
++++ b/tests/test_ledgerhelpers.py
+@@ -7,6 +7,7 @@ except ImportError:
+     journal = None
+ import tests.test_base as base
+ import tempfile
++import time
+ import unittest
+ from unittest import TestCase as T
+ 
+@@ -34,6 +35,7 @@ class TestJournal(T):
+             _, commos = j.accounts_and_last_commodity_for_account()
+             self.assertEqual(commos["Expenses:Drinking"], "1.00 CHF")
+             data = data.replace("CHF", "EUR")
++            time.sleep(0.01) # Wait a few ms to make sure st_mtime of the file changes
+             f.write(data)
+             f.flush()
+             _, commos = j.accounts_and_last_commodity_for_account()
diff -Nru ledgerhelpers-0.3.10/debian/patches/series ledgerhelpers-0.3.10/debian/patches/series
--- ledgerhelpers-0.3.10/debian/patches/series	2022-12-12 17:36:34.000000000 +0100
+++ ledgerhelpers-0.3.10/debian/patches/series	2025-07-09 09:51:04.000000000 +0200
@@ -1 +1,2 @@
 0001-Update-html-docs-location.patch
+0002-De-flake-test_reload_works.patch

Reply to: