Commit c2c78f7f authored by maruel@chromium.org's avatar maruel@chromium.org

Add a new test case for SCMWrapper.revert.

Add a test case for the UnversionedUnexpected file code path.

TEST=This test case will catch the bug fixed by r26425.
BUG=none

Patch contributed by msb@

Review URL: http://codereview.chromium.org/214005


git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@26458 0039d316-1c4b-4281-b951-d872f2087c98
parent 167b9e63
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment