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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « revert.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/revert_unittest.py
diff --git a/tests/revert_unittest.py b/tests/revert_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..3b2fd2c9293ef67bcedfa4e947f1dabab61d728f
--- /dev/null
+++ b/tests/revert_unittest.py
@@ -0,0 +1,50 @@
+#!/usr/bin/python
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Unit tests for revert.py."""
+
+import os
+import unittest
+
+# Local imports
+import revert
+
+
+class RevertTestsBase(unittest.TestCase):
+ """Setups and tear downs the mocks but doesn't test anything as-is."""
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def compareMembers(self, object, members):
+ """If you add a member, be sure to add the relevant test!"""
+ # Skip over members starting with '_' since they are usually not meant to
+ # be for public use.
+ actual_members = [x for x in sorted(dir(object))
+ if not x.startswith('_')]
+ expected_members = sorted(members)
+ if actual_members != expected_members:
+ diff = ([i for i in actual_members if i not in expected_members] +
+ [i for i in expected_members if i not in actual_members])
+ print diff
+ self.assertEqual(actual_members, expected_members)
+
+
+class RevertUnittest(RevertTestsBase):
+ """General revert.py tests."""
+ def testMembersChanged(self):
+ members = [
+ 'CaptureSVNLog', 'GetRepoBase', 'Main', 'ModifiedFile', 'NoBlameList',
+ 'NoModifiedFile', 'OutsideOfCheckout', 'Revert', 'UniqueFast',
+ 'exceptions', 'gcl', 'gclient', 'optparse', 'os', 'sys', 'xml'
+ ]
+ # If this test fails, you should add the relevant test.
+ self.compareMembers(revert, members)
+
+
+if __name__ == '__main__':
+ unittest.main()
« 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