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

Unified Diff: tests/gclient_test.py

Issue 214005: gclient_scm: add a new test case for SCMWrapper.revert (Closed)
Patch Set: tiny cleanup Created 11 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/gclient_test.py
diff --git a/tests/gclient_test.py b/tests/gclient_test.py
index eb3cd779851c3f6a7c89080147c215db858fa520..305736d536ac22792995f112eef5c5f802518da5 100644
--- a/tests/gclient_test.py
+++ b/tests/gclient_test.py
@@ -36,6 +36,7 @@ class BaseTestCase(super_mox.SuperMoxTestBase):
super_mox.SuperMoxTestBase.setUp(self)
self.mox.StubOutWithMock(gclient.os.path, 'exists')
self.mox.StubOutWithMock(gclient.os.path, 'isdir')
+ self.mox.StubOutWithMock(gclient.os, 'remove')
self.mox.StubOutWithMock(gclient.sys, 'stdout')
self.mox.StubOutWithMock(gclient_utils, 'subprocess')
# These are not tested.
@@ -1117,6 +1118,26 @@ class SCMWrapperTestCase(GClientBaseTestCase):
file_list = []
scm.revert(options, self.args, file_list)
+ def testRevertUnversionedUnexpectedFile(self):
+ options = self.Options(verbose=True)
+ base_path = os.path.join(self.root_dir, self.relpath)
+ gclient.os.path.isdir(base_path).AndReturn(True)
+ items = [
+ ('~ ', 'a'),
+ ]
+ gclient_scm.CaptureSVNStatus(base_path).AndReturn(items)
+ file_path = os.path.join(base_path, 'a')
+ print(file_path)
+ gclient_scm.os.remove(file_path).AndRaise(EnvironmentError())
+ gclient_utils.RemoveDirectory(file_path)
+ gclient_scm.RunSVN(['revert', 'a'], base_path)
+
+ self.mox.ReplayAll()
+ scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
+ relpath=self.relpath)
+ file_list = []
+ scm.revert(options, self.args, file_list)
+
def testStatus(self):
options = self.Options(verbose=True)
base_path = os.path.join(self.root_dir, self.relpath)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698