From c55cb4365a11bd9377ebea67fbe15ac06c15dc54 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 4 May 2017 18:06:18 +0530 Subject: [PATCH] Be a little more insistent when cleaning up test dir --- src/calibre/utils/test_lock.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/calibre/utils/test_lock.py b/src/calibre/utils/test_lock.py index b9d2d9371d..cc8eff6620 100644 --- a/src/calibre/utils/test_lock.py +++ b/src/calibre/utils/test_lock.py @@ -62,7 +62,12 @@ class IPCLockTest(unittest.TestCase): def tearDown(self): os.chdir(self.cwd) - shutil.rmtree(self.tdir) + for i in range(100): + try: + shutil.rmtree(self.tdir) + break + except EnvironmentError: + time.sleep(0.1) def test_exclusive_file_same_process(self): fname = 'testsp'