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

Side by Side Diff: tests/scm_unittest.py

Issue 8227036: Reapply r104938 "Make svn update not prompt during a sync." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 2 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_scm_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 27 matching lines...) Expand all
38 self.mox.StubOutWithMock(subprocess2, 'Popen') 38 self.mox.StubOutWithMock(subprocess2, 'Popen')
39 self.mox.StubOutWithMock(subprocess2, 'communicate') 39 self.mox.StubOutWithMock(subprocess2, 'communicate')
40 40
41 41
42 class RootTestCase(BaseSCMTestCase): 42 class RootTestCase(BaseSCMTestCase):
43 def testMembersChanged(self): 43 def testMembersChanged(self):
44 self.mox.ReplayAll() 44 self.mox.ReplayAll()
45 members = [ 45 members = [
46 'ElementTree', 'GetCasedPath', 'GenFakeDiff', 'GIT', 'SVN', 46 'ElementTree', 'GetCasedPath', 'GenFakeDiff', 'GIT', 'SVN',
47 'ValidateEmail', 47 'ValidateEmail',
48 'cStringIO', 'determine_scm', 'gclient_utils', 'glob', 'logging', 'os', 48 'cStringIO', 'determine_scm', 'gclient_utils', 'glob', 'logging',
49 're', 'subprocess2', 'sys', 'tempfile', 'time', 49 'only_int', 'os', 're', 'subprocess2', 'sys', 'tempfile', 'time',
50 ] 50 ]
51 # If this test fails, you should add the relevant test. 51 # If this test fails, you should add the relevant test.
52 self.compareMembers(scm, members) 52 self.compareMembers(scm, members)
53 53
54 54
55 class GitWrapperTestCase(BaseSCMTestCase): 55 class GitWrapperTestCase(BaseSCMTestCase):
56 def testMembersChanged(self): 56 def testMembersChanged(self):
57 members = [ 57 members = [
58 'AssertVersion', 'Capture', 'CaptureStatus', 58 'AssertVersion', 'Capture', 'CaptureStatus',
59 'FetchUpstreamTuple', 59 'FetchUpstreamTuple',
60 'GenerateDiff', 'GetBranch', 'GetBranchRef', 'GetCheckoutRoot', 60 'GenerateDiff', 'GetBranch', 'GetBranchRef', 'GetCheckoutRoot',
61 'GetDifferentFiles', 'GetEmail', 'GetPatchName', 'GetSVNBranch', 61 'GetDifferentFiles', 'GetEmail', 'GetPatchName', 'GetSVNBranch',
62 'GetUpstreamBranch', 'IsGitSvn', 'MatchSvnGlob', 'ShortBranchName', 62 'GetUpstreamBranch', 'IsGitSvn', 'MatchSvnGlob', 'ShortBranchName',
63 'current_version',
63 ] 64 ]
64 # If this test fails, you should add the relevant test. 65 # If this test fails, you should add the relevant test.
65 self.compareMembers(scm.GIT, members) 66 self.compareMembers(scm.GIT, members)
66 67
67 def testGetEmail(self): 68 def testGetEmail(self):
68 self.mox.StubOutWithMock(scm.GIT, 'Capture') 69 self.mox.StubOutWithMock(scm.GIT, 'Capture')
69 scm.GIT.Capture(['config', 'user.email'], cwd=self.root_dir 70 scm.GIT.Capture(['config', 'user.email'], cwd=self.root_dir
70 ).AndReturn('mini@me.com') 71 ).AndReturn('mini@me.com')
71 self.mox.ReplayAll() 72 self.mox.ReplayAll()
72 self.assertEqual(scm.GIT.GetEmail(self.root_dir), 'mini@me.com') 73 self.assertEqual(scm.GIT.GetEmail(self.root_dir), 'mini@me.com')
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 # Asserting the tree is not sufficient, svn status must come out clear too. 336 # Asserting the tree is not sufficient, svn status must come out clear too.
336 self.assertEquals('', self._capture(['status'])) 337 self.assertEquals('', self._capture(['status']))
337 338
338 339
339 if __name__ == '__main__': 340 if __name__ == '__main__':
340 if '-v' in sys.argv: 341 if '-v' in sys.argv:
341 logging.basicConfig(level=logging.DEBUG) 342 logging.basicConfig(level=logging.DEBUG)
342 unittest.main() 343 unittest.main()
343 344
344 # vim: ts=2:sw=2:tw=80:et: 345 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « tests/gclient_scm_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698