# HG changeset patch # User Risto Kankkunen # Date 1248879782 -10800 # Node ID e5a9c824ffbfbad6434faf8b3e0473b39242a4ce # Parent 7fa100ae1a117566014f6038d2daae761e26d420 Make tearDown() be able to delete read-only files to avoid an exception when removing 'testrepo/db/format' diff --git a/tests/test_svnwrap.py b/tests/test_svnwrap.py --- a/tests/test_svnwrap.py +++ b/tests/test_svnwrap.py @@ -9,6 +9,15 @@ import test_util from hgsubversion import svnwrap +import os +import stat +def force_rm(path): + os.chmod( + path, + os.stat(path).st_mode | stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH + ) + os.remove(path) + class TestBasicRepoLayout(unittest.TestCase): def setUp(self): self.tmpdir = tempfile.mkdtemp('svnwrap_test') @@ -25,7 +34,7 @@ class TestBasicRepoLayout(unittest.TestC self.repo = svnwrap.SubversionRepo(test_util.fileurl(self.repo_path)) def tearDown(self): - shutil.rmtree(self.tmpdir) + shutil.rmtree(self.tmpdir, onerror=lambda func, path, e: force_rm(path)) def test_num_revs(self):