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) |