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

Side by Side Diff: tests/scm_unittest.py

Issue 6811020: Revert r80770 "Switch from xml.dom.minidom to xml.etree" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/gclient_utils_test.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Unit tests for scm.py.""" 6 """Unit tests for scm.py."""
7 7
8 # pylint: disable=E1101,W0403 8 # pylint: disable=E1101,W0403
9 from __future__ import with_statement 9 from __future__ import with_statement
10 import logging 10 import logging
(...skipping 24 matching lines...) Expand all
35 self.mox.StubOutWithMock(scm.gclient_utils, 'CheckCall') 35 self.mox.StubOutWithMock(scm.gclient_utils, 'CheckCall')
36 self.mox.StubOutWithMock(scm.gclient_utils, 'CheckCallAndFilter') 36 self.mox.StubOutWithMock(scm.gclient_utils, 'CheckCallAndFilter')
37 self.mox.StubOutWithMock(scm.gclient_utils, 'CheckCallAndFilterAndHeader') 37 self.mox.StubOutWithMock(scm.gclient_utils, 'CheckCallAndFilterAndHeader')
38 self.mox.StubOutWithMock(scm.gclient_utils, 'Popen') 38 self.mox.StubOutWithMock(scm.gclient_utils, 'Popen')
39 39
40 40
41 class RootTestCase(BaseSCMTestCase): 41 class RootTestCase(BaseSCMTestCase):
42 def testMembersChanged(self): 42 def testMembersChanged(self):
43 self.mox.ReplayAll() 43 self.mox.ReplayAll()
44 members = [ 44 members = [
45 'ElementTree', 'GetCasedPath', 'GenFakeDiff', 'GIT', 'SVN', 45 'GetCasedPath', 'GenFakeDiff', 'GIT', 'SVN', 'ValidateEmail',
46 'ValidateEmail',
47 'cStringIO', 'determine_scm', 'gclient_utils', 'glob', 'logging', 'os', 46 'cStringIO', 'determine_scm', 'gclient_utils', 'glob', 'logging', 'os',
48 're', 'shutil', 'subprocess', 'subprocess2', 'sys', 'tempfile', 'time', 47 're', 'shutil', 'subprocess', 'subprocess2', 'sys', 'tempfile', 'time',
48 'xml',
49 ] 49 ]
50 # If this test fails, you should add the relevant test. 50 # If this test fails, you should add the relevant test.
51 self.compareMembers(scm, members) 51 self.compareMembers(scm, members)
52 52
53 53
54 class GitWrapperTestCase(BaseSCMTestCase): 54 class GitWrapperTestCase(BaseSCMTestCase):
55 def testMembersChanged(self): 55 def testMembersChanged(self):
56 members = [ 56 members = [
57 'AssertVersion', 'Capture', 'CaptureStatus', 57 'AssertVersion', 'Capture', 'CaptureStatus',
58 'FetchUpstreamTuple', 58 'FetchUpstreamTuple',
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 'IsMovedInfo', 'ReadSimpleAuth', 'Revert', 'RunAndGetFileList', 97 'IsMovedInfo', 'ReadSimpleAuth', 'Revert', 'RunAndGetFileList',
98 ] 98 ]
99 # If this test fails, you should add the relevant test. 99 # If this test fails, you should add the relevant test.
100 self.compareMembers(scm.SVN, members) 100 self.compareMembers(scm.SVN, members)
101 101
102 def testGetCheckoutRoot(self): 102 def testGetCheckoutRoot(self):
103 self.mox.StubOutWithMock(scm.SVN, 'CaptureInfo') 103 self.mox.StubOutWithMock(scm.SVN, 'CaptureInfo')
104 self.mox.StubOutWithMock(scm, 'GetCasedPath') 104 self.mox.StubOutWithMock(scm, 'GetCasedPath')
105 scm.os.path.abspath = lambda x: x 105 scm.os.path.abspath = lambda x: x
106 scm.GetCasedPath = lambda x: x 106 scm.GetCasedPath = lambda x: x
107 # pylint: disable=E1103
108 scm.SVN.CaptureInfo(self.root_dir + '/foo/bar').AndReturn({ 107 scm.SVN.CaptureInfo(self.root_dir + '/foo/bar').AndReturn({
109 'Repository Root': 'svn://svn.chromium.org/chrome', 108 'Repository Root': 'svn://svn.chromium.org/chrome',
110 'URL': 'svn://svn.chromium.org/chrome/trunk/src', 109 'URL': 'svn://svn.chromium.org/chrome/trunk/src',
111 }) 110 })
112 scm.SVN.CaptureInfo(self.root_dir + '/foo').AndReturn({ 111 scm.SVN.CaptureInfo(self.root_dir + '/foo').AndReturn({
113 'Repository Root': 'svn://svn.chromium.org/chrome', 112 'Repository Root': 'svn://svn.chromium.org/chrome',
114 'URL': 'svn://svn.chromium.org/chrome/trunk', 113 'URL': 'svn://svn.chromium.org/chrome/trunk',
115 }) 114 })
116 scm.SVN.CaptureInfo(self.root_dir).AndReturn({ 115 scm.SVN.CaptureInfo(self.root_dir).AndReturn({
117 'Repository Root': 'svn://svn.chromium.org/chrome', 116 'Repository Root': 'svn://svn.chromium.org/chrome',
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 # Asserting the tree is not sufficient, svn status must come out clear too. 333 # Asserting the tree is not sufficient, svn status must come out clear too.
335 self.assertEquals('', self._capture(['status'])) 334 self.assertEquals('', self._capture(['status']))
336 335
337 336
338 if __name__ == '__main__': 337 if __name__ == '__main__':
339 if '-v' in sys.argv: 338 if '-v' in sys.argv:
340 logging.basicConfig(level=logging.DEBUG) 339 logging.basicConfig(level=logging.DEBUG)
341 unittest.main() 340 unittest.main()
342 341
343 # vim: ts=2:sw=2:tw=80:et: 342 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « tests/gclient_utils_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698