mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
Make tearDown() be able to delete read-only files to avoid an exception when removing 'testrepo/db/format'
This commit is contained in:
parent
7ef4f586e9
commit
1f2d044467
@ -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.TestCase):
|
||||
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):
|
||||
|
Loading…
Reference in New Issue
Block a user