mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 03:04:42 +02:00
Retry cleanup to avoid errors due to transient file locks on windows
This commit is contained in:
parent
308b7cfb23
commit
819f4b1daa
1 changed files with 8 additions and 2 deletions
|
|
@ -7,7 +7,7 @@
|
|||
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import unittest, os, shutil, tempfile, atexit, gc
|
||||
import unittest, os, shutil, tempfile, atexit, gc, time
|
||||
from functools import partial
|
||||
from io import BytesIO
|
||||
from future_builtins import map
|
||||
|
|
@ -31,7 +31,13 @@ def tearDown(self):
|
|||
from calibre.utils.recycle_bin import restore_recyle
|
||||
restore_recyle()
|
||||
gc.collect(), gc.collect()
|
||||
shutil.rmtree(self.library_path)
|
||||
try:
|
||||
shutil.rmtree(self.library_path)
|
||||
except EnvironmentError:
|
||||
# Try again in case something transient has a file lock on windows
|
||||
gc.collect(), gc.collect()
|
||||
time.sleep(2)
|
||||
shutil.rmtree(self.library_path)
|
||||
|
||||
def create_db(self, library_path):
|
||||
from calibre.library.database2 import LibraryDatabase2
|
||||
|
|
|
|||
Loading…
Reference in a new issue