From e49b79c8cead734a8ca71eaf009acf5566d91682 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jul 14 2017 19:54:57 +0000 Subject: Ugly but works, try to delete the folder twice Signed-off-by: Pierre-Yves Chibon --- diff --git a/tests/__init__.py b/tests/__init__.py index daebe20..9c962ed 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -255,7 +255,13 @@ class SimplePagureTest(unittest.TestCase): requests.get('%s/clean/%s' % (FAITOUT_URL, db_name)) # Remove testdir - shutil.rmtree(self.path) + try: + shutil.rmtree(self.path) + except: + # Sometimes there is a race condition that makes deleting the folder + # fail during the first attempt. So just try a second time if that's + # the case. + shutil.rmtree(self.path) self.path = None def get_csrf(self, url='/new', output=None):