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

Unified Diff: tests/gclient_scm_test.py

Issue 391052: Group SCM-specific functions in classes to simplify generalization of the interface. (Closed)
Patch Set: One more fix Created 11 years, 1 month 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
« scm.py ('K') | « tests/gcl_unittest.py ('k') | tests/gclient_test.py » ('j') | 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 11a2cd933c98f7274345d89c84cb3438138bd9f5..e62711a975b4f34d77f8a6fc8291b671e1542499 100755
--- a/tests/gclient_scm_test.py
+++ b/tests/gclient_scm_test.py
@@ -33,12 +33,12 @@ class BaseTestCase(GCBaseTestCase):
self.mox.StubOutWithMock(gclient_scm.gclient_utils, 'FileWrite')
self.mox.StubOutWithMock(gclient_scm.gclient_utils, 'SubprocessCall')
self.mox.StubOutWithMock(gclient_scm.gclient_utils, 'RemoveDirectory')
- self._CaptureSVNInfo = gclient_scm.CaptureSVNInfo
- self.mox.StubOutWithMock(gclient_scm, 'CaptureSVN')
- self.mox.StubOutWithMock(gclient_scm, 'CaptureSVNInfo')
- self.mox.StubOutWithMock(gclient_scm, 'CaptureSVNStatus')
- self.mox.StubOutWithMock(gclient_scm, 'RunSVN')
- self.mox.StubOutWithMock(gclient_scm, 'RunSVNAndGetFileList')
+ self._CaptureSVNInfo = gclient_scm.scm.SVN.CaptureInfo
+ self.mox.StubOutWithMock(gclient_scm.scm.SVN, 'Capture')
+ self.mox.StubOutWithMock(gclient_scm.scm.SVN, 'CaptureInfo')
+ self.mox.StubOutWithMock(gclient_scm.scm.SVN, 'CaptureStatus')
+ self.mox.StubOutWithMock(gclient_scm.scm.SVN, 'Run')
+ self.mox.StubOutWithMock(gclient_scm.scm.SVN, 'RunAndGetFileList')
self._scm_wrapper = gclient_scm.CreateSCM
@@ -64,9 +64,11 @@ class SVNWrapperTestCase(BaseTestCase):
def testDir(self):
members = [
- 'FullUrlForRelativeUrl', 'RunCommand', 'cleanup', 'diff', 'export',
- 'pack', 'relpath', 'revert', 'revinfo', 'runhooks', 'scm_name', 'status',
- 'update', 'url',
+ 'COMMAND', 'Capture', 'CaptureHeadRevision', 'CaptureInfo',
+ 'CaptureStatus', 'DiffItem', 'FullUrlForRelativeUrl', 'GetFileProperty',
+ 'IsMoved', 'Run', 'RunAndFilterOutput', 'RunAndGetFileList',
+ 'RunCommand', 'cleanup', 'diff', 'export', 'pack', 'relpath', 'revert',
+ 'revinfo', 'runhooks', 'scm_name', 'status', 'update', 'url',
]
# If you add a member, be sure to add the relevant test!
@@ -113,8 +115,9 @@ class SVNWrapperTestCase(BaseTestCase):
# Checkout.
gclient_scm.os.path.exists(base_path).AndReturn(False)
files_list = self.mox.CreateMockAnything()
- gclient_scm.RunSVNAndGetFileList(options, ['checkout', self.url, base_path],
- self.root_dir, files_list)
+ gclient_scm.scm.SVN.RunAndGetFileList(options,
+ ['checkout', self.url, base_path],
+ self.root_dir, files_list)
self.mox.ReplayAll()
scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
@@ -125,9 +128,10 @@ class SVNWrapperTestCase(BaseTestCase):
options = self.Options(verbose=True)
base_path = gclient_scm.os.path.join(self.root_dir, self.relpath)
gclient_scm.os.path.isdir(base_path).AndReturn(True)
- gclient_scm.CaptureSVNStatus(base_path).AndReturn([])
- gclient_scm.RunSVNAndGetFileList(options, ['update', '--revision', 'BASE'],
- base_path, mox.IgnoreArg())
+ gclient_scm.scm.SVN.CaptureStatus(base_path).AndReturn([])
+ gclient_scm.scm.SVN.RunAndGetFileList(options,
+ ['update', '--revision', 'BASE'],
+ base_path, mox.IgnoreArg())
self.mox.ReplayAll()
scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
@@ -145,15 +149,16 @@ class SVNWrapperTestCase(BaseTestCase):
]
file_path1 = gclient_scm.os.path.join(base_path, 'a')
file_path2 = gclient_scm.os.path.join(base_path, 'b')
- gclient_scm.CaptureSVNStatus(base_path).AndReturn(items)
+ gclient_scm.scm.SVN.CaptureStatus(base_path).AndReturn(items)
gclient_scm.os.path.exists(file_path1).AndReturn(True)
gclient_scm.os.path.isfile(file_path1).AndReturn(True)
gclient_scm.os.remove(file_path1)
gclient_scm.os.path.exists(file_path2).AndReturn(True)
gclient_scm.os.path.isfile(file_path2).AndReturn(True)
gclient_scm.os.remove(file_path2)
- gclient_scm.RunSVNAndGetFileList(options, ['update', '--revision', 'BASE'],
- base_path, mox.IgnoreArg())
+ gclient_scm.scm.SVN.RunAndGetFileList(options,
+ ['update', '--revision', 'BASE'],
+ base_path, mox.IgnoreArg())
print(gclient_scm.os.path.join(base_path, 'a'))
print(gclient_scm.os.path.join(base_path, 'b'))
@@ -170,7 +175,7 @@ class SVNWrapperTestCase(BaseTestCase):
items = [
('~ ', 'a'),
]
- gclient_scm.CaptureSVNStatus(base_path).AndReturn(items)
+ gclient_scm.scm.SVN.CaptureStatus(base_path).AndReturn(items)
file_path = gclient_scm.os.path.join(base_path, 'a')
print(file_path)
gclient_scm.os.path.exists(file_path).AndReturn(True)
@@ -178,8 +183,9 @@ class SVNWrapperTestCase(BaseTestCase):
gclient_scm.os.path.isdir(file_path).AndReturn(True)
gclient_scm.gclient_utils.RemoveDirectory(file_path)
file_list1 = []
- gclient_scm.RunSVNAndGetFileList(options, ['update', '--revision', 'BASE'],
- base_path, mox.IgnoreArg())
+ gclient_scm.scm.SVN.RunAndGetFileList(options,
+ ['update', '--revision', 'BASE'],
+ base_path, mox.IgnoreArg())
self.mox.ReplayAll()
scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
@@ -191,8 +197,9 @@ class SVNWrapperTestCase(BaseTestCase):
options = self.Options(verbose=True)
base_path = gclient_scm.os.path.join(self.root_dir, self.relpath)
gclient_scm.os.path.isdir(base_path).AndReturn(True)
- gclient_scm.RunSVNAndGetFileList(options, ['status'] + self.args,
- base_path, []).AndReturn(None)
+ gclient_scm.scm.SVN.RunAndGetFileList(options,
+ ['status'] + self.args,
+ base_path, []).AndReturn(None)
self.mox.ReplayAll()
scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
@@ -216,8 +223,9 @@ class SVNWrapperTestCase(BaseTestCase):
# Checkout.
gclient_scm.os.path.exists(base_path).AndReturn(False)
files_list = self.mox.CreateMockAnything()
- gclient_scm.RunSVNAndGetFileList(options, ['checkout', self.url,
- base_path], self.root_dir, files_list)
+ gclient_scm.scm.SVN.RunAndGetFileList(options,
+ ['checkout', self.url, base_path],
+ self.root_dir, files_list)
self.mox.ReplayAll()
scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
relpath=self.relpath)
@@ -238,17 +246,19 @@ class SVNWrapperTestCase(BaseTestCase):
).AndReturn(False)
# Checkout or update.
gclient_scm.os.path.exists(base_path).AndReturn(True)
- gclient_scm.CaptureSVNInfo(gclient_scm.os.path.join(base_path, "."), '.'
- ).AndReturn(file_info)
+ gclient_scm.scm.SVN.CaptureInfo(
+ gclient_scm.os.path.join(base_path, "."), '.'
+ ).AndReturn(file_info)
# Cheat a bit here.
- gclient_scm.CaptureSVNInfo(file_info['URL'], '.').AndReturn(file_info)
+ gclient_scm.scm.SVN.CaptureInfo(file_info['URL'], '.').AndReturn(file_info)
additional_args = []
if options.manually_grab_svn_rev:
additional_args = ['--revision', str(file_info['Revision'])]
files_list = []
- gclient_scm.RunSVNAndGetFileList(options,
- ['update', base_path] + additional_args,
- self.root_dir, files_list)
+ gclient_scm.scm.SVN.RunAndGetFileList(
+ options,
+ ['update', base_path] + additional_args,
+ self.root_dir, files_list)
self.mox.ReplayAll()
scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
@@ -356,9 +366,9 @@ from :3
def testDir(self):
members = [
- 'FullUrlForRelativeUrl', 'RunCommand', 'cleanup', 'diff', 'export',
- 'relpath', 'revert', 'revinfo', 'runhooks', 'scm_name', 'status',
- 'update', 'url',
+ 'COMMAND', 'Capture', 'CaptureStatus', 'FullUrlForRelativeUrl',
+ 'RunCommand', 'cleanup', 'diff', 'export', 'relpath', 'revert',
+ 'revinfo', 'runhooks', 'scm_name', 'status', 'update', 'url',
]
# If you add a member, be sure to add the relevant test!
« scm.py ('K') | « tests/gcl_unittest.py ('k') | tests/gclient_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698