summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/test_farm.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/test_farm.py b/test/test_farm.py
index 630f1011..6adfe6ad 100644
--- a/test/test_farm.py
+++ b/test/test_farm.py
@@ -295,7 +295,11 @@ class FarmTestCase(object):
def clean(self, cleandir):
"""Clean `cleandir` by removing it and all its children completely."""
if os.path.exists(cleandir):
- shutil.rmtree(cleandir)
+ # rmtree gives mysterious failures on Win7, so use an onerror
+ # function that simply retries the operation. Why that helps, I
+ # have no idea.
+ shutil.rmtree(cleandir, onerror=lambda fn, path, exc: fn(path))
+
def main(): # pragma: no cover
"""Command-line access to test_farm.