| Index: tests/gclient_scm_test.py
|
| diff --git a/tests/gclient_scm_test.py b/tests/gclient_scm_test.py
|
| index d3fdc684f58ab796de2284c51ea2f547ba06c85d..00592244c90ab633a05752319e5e4569aacdf28d 100755
|
| --- a/tests/gclient_scm_test.py
|
| +++ b/tests/gclient_scm_test.py
|
| @@ -133,6 +133,7 @@ class BaseGitWrapperTestCase(GCBaseTestCase, StdoutCheck, TestCaseUtils,
|
| self.cache_dir = None
|
| self.merge = False
|
| self.jobs = 1
|
| + self.break_repo_locks = False
|
| self.delete_unversioned_trees = False
|
|
|
| sample_git_import = """blob
|
| @@ -501,6 +502,36 @@ class ManagedGitWrapperTestCase(BaseGitWrapperTestCase):
|
| sys.stdout.getvalue()
|
| sys.stdout.close()
|
|
|
| + def testUpdateLocked(self):
|
| + if not self.enabled:
|
| + return
|
| + options = self.Options()
|
| + scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir,
|
| + relpath=self.relpath)
|
| + file_path = join(self.base_path, '.git', 'index.lock')
|
| + with open(file_path, 'w'):
|
| + pass
|
| + with self.assertRaisesRegexp(subprocess2.CalledProcessError,
|
| + 'Unable to create.*/index.lock'):
|
| + scm.update(options, (), [])
|
| + sys.stdout.close()
|
| +
|
| + def testUpdateLockedBreak(self):
|
| + if not self.enabled:
|
| + return
|
| + options = self.Options()
|
| + options.break_repo_locks = True
|
| + scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir,
|
| + relpath=self.relpath)
|
| + file_path = join(self.base_path, '.git', 'index.lock')
|
| + with open(file_path, 'w'):
|
| + pass
|
| + scm.update(options, (), [])
|
| + self.assertRegexpMatches(sys.stdout.getvalue(),
|
| + "breaking lock.*\.git/index\.lock")
|
| + self.assertFalse(os.path.exists(file_path))
|
| + sys.stdout.close()
|
| +
|
| def testUpdateConflict(self):
|
| if not self.enabled:
|
| return
|
| @@ -542,6 +573,7 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase):
|
| self.force = force
|
| self.reset = False
|
| self.nohooks = False
|
| + self.break_repo_locks = False
|
| # TODO(maruel): Test --jobs > 1.
|
| self.jobs = 1
|
|
|
|
|