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

Side by Side Diff: tests/trychange_unittest.py

Issue 113218: Starts reusing functions in gclient.py from gcl.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 11 years, 7 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/gcl_unittest.py ('k') | trychange.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 #!/usr/bin/python
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """Unit tests for trychange.py."""
7
8 import os
9 import unittest
10
11 # Local imports
12 import trychange
13
14
15 class TryChangeTestsBase(unittest.TestCase):
16 """Setups and tear downs the mocks but doesn't test anything as-is."""
17 def setUp(self):
18 pass
19
20 def tearDown(self):
21 pass
22
23 def compareMembers(self, object, members):
24 """If you add a member, be sure to add the relevant test!"""
25 # Skip over members starting with '_' since they are usually not meant to
26 # be for public use.
27 actual_members = [x for x in sorted(dir(object))
28 if not x.startswith('_')]
29 expected_members = sorted(members)
30 if actual_members != expected_members:
31 diff = ([i for i in actual_members if i not in expected_members] +
32 [i for i in expected_members if i not in actual_members])
33 print diff
34 self.assertEqual(actual_members, expected_members)
35
36
37 class TryChangeUnittest(TryChangeTestsBase):
38 """General trychange.py tests."""
39 def testMembersChanged(self):
40 members = [
41 'EscapeDot', 'ExecuteTryServerScript', 'GIT', 'GetSourceRoot', 'GuessVCS',
42 'HELP_STRING', 'InvalidScript', 'NoTryServerAccess', 'PathDifference',
43 'RunCommand', 'SCM', 'SCRIPT_PATH', 'SVN', 'TryChange', 'USAGE',
44 'datetime', 'gcl', 'gclient', 'getpass', 'logging', 'optparse', 'os',
45 'shutil', 'sys', 'tempfile', 'traceback', 'urllib',
46 ]
47 # If this test fails, you should add the relevant test.
48 self.compareMembers(trychange, members)
49
50
51 class SVNUnittest(TryChangeTestsBase):
52 """General trychange.py tests."""
53 def testMembersChanged(self):
54 members = [
55 'GenerateDiff', 'ProcessOptions', 'options'
56 ]
57 # If this test fails, you should add the relevant test.
58 self.compareMembers(trychange.SVN(None), members)
59
60
61 class TryChangeUnittest(TryChangeTestsBase):
62 """General trychange.py tests."""
63 def testMembersChanged(self):
64 members = [
65 'GenerateDiff', 'GetEmail', 'GetPatchName', 'ProcessOptions', 'options'
66 ]
67 # If this test fails, you should add the relevant test.
68 self.compareMembers(trychange.GIT(None), members)
69
70
71 if __name__ == '__main__':
72 unittest.main()
OLDNEW
« no previous file with comments | « tests/gcl_unittest.py ('k') | trychange.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698