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

Side by Side Diff: tests/revert_unittest.py

Issue 115514: Clean up revert.py and fixes an issue when only one file is reverted in a subdirectory. (Closed)
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
« no previous file with comments | « revert.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
(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 revert.py."""
7
8 import os
9 import unittest
10
11 # Local imports
12 import revert
13
14
15 class RevertTestsBase(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 RevertUnittest(RevertTestsBase):
38 """General revert.py tests."""
39 def testMembersChanged(self):
40 members = [
41 'CaptureSVNLog', 'GetRepoBase', 'Main', 'ModifiedFile', 'NoBlameList',
42 'NoModifiedFile', 'OutsideOfCheckout', 'Revert', 'UniqueFast',
43 'exceptions', 'gcl', 'gclient', 'optparse', 'os', 'sys', 'xml'
44 ]
45 # If this test fails, you should add the relevant test.
46 self.compareMembers(revert, members)
47
48
49 if __name__ == '__main__':
50 unittest.main()
OLDNEW
« no previous file with comments | « revert.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698