diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2010-01-10 10:41:10 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2010-01-10 10:41:10 -0500 |
commit | b5b580fe8a34c530aad1c897b8ad4718f8f7db86 (patch) | |
tree | c1f2d1075a1b5759b190df084badd039c9899513 | |
parent | f8c935a94778a5497ed91a1d9e4e959d59194a46 (diff) | |
download | python-coveragepy-git-b5b580fe8a34c530aad1c897b8ad4718f8f7db86.tar.gz |
Avoid random file deletion errors on Windows.
-rw-r--r-- | test/test_farm.py | 6 |
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. |