From 8660e2097643e48f42c8193b179cc26b9460ef1c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 17 Jul 2022 21:54:06 +0530 Subject: [PATCH] Make test a bit more robust --- src/calibre/db/tests/writing.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/calibre/db/tests/writing.py b/src/calibre/db/tests/writing.py index a5cc86647a..014a1eb970 100644 --- a/src/calibre/db/tests/writing.py +++ b/src/calibre/db/tests/writing.py @@ -845,7 +845,14 @@ class WritingTest(BaseTest): def ae(l, r): # We need to sleep a bit to allow events to happen on its thread import time - time.sleep(.001) + st = time.monotonic() + while time.monotonic() - st < 1: + time.sleep(0.01) + try: + self.assertEqual(l, r) + return + except Exception: + pass self.assertEqual(l, r) cache = self.init_cache(self.cloned_library)