Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 trychange.py.""" | 6 """Unit tests for trychange.py.""" |
| 7 | 7 |
| 8 import os | 8 import os |
| 9 import sys | 9 import sys |
| 10 | 10 |
| 11 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | 11 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| 12 | 12 |
| 13 from testing_support.super_mox import SuperMoxTestBase | 13 from testing_support.super_mox import SuperMoxTestBase |
| 14 | 14 |
| 15 import subprocess2 | 15 import subprocess2 |
| 16 import trychange | 16 import trychange |
| 17 | 17 |
| 18 # pylint: disable=E1103 | |
|
M-A Ruel
2012/02/11 02:38:08
?
Dan Beam
2012/02/11 02:42:36
pylint was complaining that it's type checking suc
| |
| 18 | 19 |
| 19 class TryChangeTestsBase(SuperMoxTestBase): | 20 class TryChangeTestsBase(SuperMoxTestBase): |
| 20 """Setups and tear downs the mocks but doesn't test anything as-is.""" | 21 """Setups and tear downs the mocks but doesn't test anything as-is.""" |
| 21 def setUp(self): | 22 def setUp(self): |
| 22 SuperMoxTestBase.setUp(self) | 23 SuperMoxTestBase.setUp(self) |
| 23 self.mox.StubOutWithMock(subprocess2, 'communicate') | 24 self.mox.StubOutWithMock(subprocess2, 'communicate') |
| 24 self.mox.StubOutWithMock(trychange.scm.GIT, 'Capture') | 25 self.mox.StubOutWithMock(trychange.scm.GIT, 'Capture') |
| 25 self.mox.StubOutWithMock(trychange.scm.GIT, 'GenerateDiff') | 26 self.mox.StubOutWithMock(trychange.scm.GIT, 'GenerateDiff') |
| 26 self.mox.StubOutWithMock(trychange.scm.GIT, 'GetCheckoutRoot') | 27 self.mox.StubOutWithMock(trychange.scm.GIT, 'GetCheckoutRoot') |
| 27 self.mox.StubOutWithMock(trychange.scm.GIT, 'GetEmail') | 28 self.mox.StubOutWithMock(trychange.scm.GIT, 'GetEmail') |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 self.mox.ReplayAll() | 107 self.mox.ReplayAll() |
| 107 git = trychange.GIT(self.options, self.fake_root, self.options.files) | 108 git = trychange.GIT(self.options, self.fake_root, self.options.files) |
| 108 self.assertEqual(git.GetFileNames(), self.expected_files) | 109 self.assertEqual(git.GetFileNames(), self.expected_files) |
| 109 self.assertEqual(git.checkout_root, self.fake_root) | 110 self.assertEqual(git.checkout_root, self.fake_root) |
| 110 self.assertEqual(git.GenerateDiff(), 'A diff') | 111 self.assertEqual(git.GenerateDiff(), 'A diff') |
| 111 | 112 |
| 112 | 113 |
| 113 if __name__ == '__main__': | 114 if __name__ == '__main__': |
| 114 import unittest | 115 import unittest |
| 115 unittest.main() | 116 unittest.main() |
| OLD | NEW |