attempt to fix rmtree Windows issues in test case
authorLisandro Dalcin <dalcinl@gmail.com>
Mon, 7 Feb 2011 20:14:07 +0000 (17:14 -0300)
committerLisandro Dalcin <dalcinl@gmail.com>
Mon, 7 Feb 2011 20:14:07 +0000 (17:14 -0300)
runtests.py

index 844477bae64ac398f485825922aa16179c69fbb7..acfcb609385a656cae1731061f5ddbe24fc4526c 100644 (file)
@@ -6,6 +6,7 @@ import re
 import gc
 import codecs
 import shutil
+import time
 import unittest
 import doctest
 import operator
@@ -816,7 +817,13 @@ class EndToEndTest(unittest.TestCase):
 
     def tearDown(self):
         if self.cleanup_workdir:
-            shutil.rmtree(self.workdir)
+            for trial in range(5):
+                try:
+                    shutil.rmtree(self.workdir)
+                except OSError:
+                    time.sleep(0.1)
+                else:
+                    break
         os.chdir(self.old_dir)
 
     def runTest(self):