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 gclient_scm.py.""" | 6 """Unit tests for gclient_scm.py.""" |
| 7 | 7 |
| 8 # pylint: disable=E1101,E1103,W0403 | 8 # pylint: disable=E1101,E1103,W0403 |
| 9 | 9 |
| 10 # Import before super_mox to keep valid references. | 10 # Import before super_mox to keep valid references. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 self.jobs = 1 | 77 self.jobs = 1 |
| 78 | 78 |
| 79 def Options(self, *args, **kwargs): | 79 def Options(self, *args, **kwargs): |
| 80 return self.OptionsObject(*args, **kwargs) | 80 return self.OptionsObject(*args, **kwargs) |
| 81 | 81 |
| 82 def setUp(self): | 82 def setUp(self): |
| 83 BaseTestCase.setUp(self) | 83 BaseTestCase.setUp(self) |
| 84 self.url = self.SvnUrl() | 84 self.url = self.SvnUrl() |
| 85 | 85 |
| 86 def testDir(self): | 86 def testDir(self): |
| 87 members = [ | 87 members = [ 'FindSafesyncRev', |
|
M-A Ruel
2011/11/08 14:29:20
Align at +4 instead, it's easier to refactor after
Dan Beam
2011/11/09 10:31:15
Done.
| |
| 88 'FullUrlForRelativeUrl', 'GetRevisionDate', 'RunCommand', | 88 'FullUrlForRelativeUrl', |
| 89 'cleanup', 'diff', 'pack', 'relpath', 'revert', | 89 'GetRevisionDate', |
| 90 'revinfo', 'runhooks', 'status', 'update', | 90 'RunCommand', |
| 91 'updatesingle', 'url', | 91 'cleanup', |
| 92 ] | 92 'diff', |
| 93 'pack', | |
| 94 'relpath', | |
| 95 'revert', | |
| 96 'revinfo', | |
| 97 'runhooks', | |
| 98 'status', | |
| 99 'update', | |
| 100 'updatesingle', | |
| 101 'url' | |
| 102 ] | |
| 93 | 103 |
| 94 # If you add a member, be sure to add the relevant test! | 104 # If you add a member, be sure to add the relevant test! |
| 95 self.compareMembers(self._scm_wrapper('svn://a'), members) | 105 self.compareMembers(self._scm_wrapper('svn://a'), members) |
| 96 | 106 |
| 97 def testUnsupportedSCM(self): | 107 def testUnsupportedSCM(self): |
| 98 args = ['gopher://foo', self.root_dir, self.relpath] | 108 args = ['gopher://foo', self.root_dir, self.relpath] |
| 99 exception_msg = 'No SCM found for url gopher://foo' | 109 exception_msg = 'No SCM found for url gopher://foo' |
| 100 self.assertRaisesError(exception_msg, self._scm_wrapper, *args) | 110 self.assertRaisesError(exception_msg, self._scm_wrapper, *args) |
| 101 | 111 |
| 102 def testSVNFullUrlForRelativeUrl(self): | 112 def testSVNFullUrlForRelativeUrl(self): |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 612 | 622 |
| 613 def tearDown(self): | 623 def tearDown(self): |
| 614 StdoutCheck.tearDown(self) | 624 StdoutCheck.tearDown(self) |
| 615 TestCaseUtils.tearDown(self) | 625 TestCaseUtils.tearDown(self) |
| 616 unittest.TestCase.tearDown(self) | 626 unittest.TestCase.tearDown(self) |
| 617 rmtree(self.root_dir) | 627 rmtree(self.root_dir) |
| 618 | 628 |
| 619 | 629 |
| 620 class ManagedGitWrapperTestCase(BaseGitWrapperTestCase): | 630 class ManagedGitWrapperTestCase(BaseGitWrapperTestCase): |
| 621 def testDir(self): | 631 def testDir(self): |
| 622 members = [ | 632 members = [ 'FindSafesyncRev', |
| 623 'FullUrlForRelativeUrl', 'GetRevisionDate', 'RunCommand', | 633 'FullUrlForRelativeUrl', |
| 624 'cleanup', 'diff', 'pack', 'relpath', 'revert', | 634 'GetRevisionDate', |
| 625 'revinfo', 'runhooks', 'status', 'update', 'url', | 635 'RunCommand', |
| 626 ] | 636 'cleanup', |
| 637 'diff', | |
| 638 'pack', | |
| 639 'relpath', | |
| 640 'revert', | |
| 641 'revinfo', | |
| 642 'runhooks', | |
| 643 'status', | |
| 644 'update', | |
| 645 'url', | |
| 646 ] | |
| 627 | 647 |
| 628 # If you add a member, be sure to add the relevant test! | 648 # If you add a member, be sure to add the relevant test! |
| 629 self.compareMembers(gclient_scm.CreateSCM(url=self.url), members) | 649 self.compareMembers(gclient_scm.CreateSCM(url=self.url), members) |
| 630 | 650 |
| 631 def testRevertMissing(self): | 651 def testRevertMissing(self): |
| 632 if not self.enabled: | 652 if not self.enabled: |
| 633 return | 653 return |
| 634 options = self.Options() | 654 options = self.Options() |
| 635 file_path = join(self.base_path, 'a') | 655 file_path = join(self.base_path, 'a') |
| 636 scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir, | 656 scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir, |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 962 | 982 |
| 963 if __name__ == '__main__': | 983 if __name__ == '__main__': |
| 964 if '-v' in sys.argv: | 984 if '-v' in sys.argv: |
| 965 logging.basicConfig( | 985 logging.basicConfig( |
| 966 level=logging.DEBUG, | 986 level=logging.DEBUG, |
| 967 format='%(asctime).19s %(levelname)s %(filename)s:' | 987 format='%(asctime).19s %(levelname)s %(filename)s:' |
| 968 '%(lineno)s %(message)s') | 988 '%(lineno)s %(message)s') |
| 969 unittest.main() | 989 unittest.main() |
| 970 | 990 |
| 971 # vim: ts=2:sw=2:tw=80:et: | 991 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |