From 7dbdfd565d21d7da009497ca5f02c63bf4ee78c0 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 20 Nov 2022 09:11:49 +0530 Subject: [PATCH] Retry deleting since on windows something could have locked a file --- src/calibre/db/tests/fts_api.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/db/tests/fts_api.py b/src/calibre/db/tests/fts_api.py index 93de111f52..38ac1027cf 100644 --- a/src/calibre/db/tests/fts_api.py +++ b/src/calibre/db/tests/fts_api.py @@ -42,7 +42,11 @@ class FTSAPITest(BaseTest): def new_library(self): if os.path.exists(self.library_path): - shutil.rmtree(self.library_path) + try: + shutil.rmtree(self.library_path) + except PermissionError: + time.sleep(5) + shutil.rmtree(self.library_path) os.makedirs(self.library_path) self.create_db(self.library_path) ans = self.init_cache()