Chromium Code Reviews| Index: tests/gclient_scm_test.py |
| diff --git a/tests/gclient_scm_test.py b/tests/gclient_scm_test.py |
| index d3fdc684f58ab796de2284c51ea2f547ba06c85d..374023c9104bb23d0977cb4c23f0ef5ce58a10cd 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,35 @@ 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") |
|
pgervais
2016/04/06 15:53:30
I would also check that the file has actually been
iannucci
2016/04/06 17:29:18
Done.
|
| + sys.stdout.close() |
| + |
| def testUpdateConflict(self): |
| if not self.enabled: |
| return |
| @@ -542,6 +572,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 |