Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1337)

Unified Diff: tests/gclient_scm_test.py

Issue 1867843003: Revert of Revert "Add (another) argument to break git locks in gclient." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gclient_scm.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 @@
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 @@
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 @@
self.force = force
self.reset = False
self.nohooks = False
+ self.break_repo_locks = False
# TODO(maruel): Test --jobs > 1.
self.jobs = 1
« no previous file with comments | « gclient_scm.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698