OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 presubmit_support.py and presubmit_canned_checks.py.""" | 6 """Unit tests for presubmit_support.py and presubmit_canned_checks.py.""" |
7 | 7 |
8 # pylint: disable=E1101,E1103 | 8 # pylint: disable=E1101,E1103 |
9 | 9 |
10 import logging | 10 import logging |
(...skipping 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2412 'other than john@example.com\n') | 2412 'other than john@example.com\n') |
2413 self.AssertOwnersWorks(approvers=set(['john@example.com']), | 2413 self.AssertOwnersWorks(approvers=set(['john@example.com']), |
2414 is_committing=False, | 2414 is_committing=False, |
2415 expected_output='') | 2415 expected_output='') |
2416 | 2416 |
2417 def testCannedCheckOwners_AuthorCountsAsOwner(self): | 2417 def testCannedCheckOwners_AuthorCountsAsOwner(self): |
2418 self.AssertOwnersWorks(approvers=set(['john@example.com', | 2418 self.AssertOwnersWorks(approvers=set(['john@example.com', |
2419 'brett@example.com']), | 2419 'brett@example.com']), |
2420 reviewers=set(['john@example.com', | 2420 reviewers=set(['john@example.com', |
2421 'ben@example.com']), | 2421 'ben@example.com']), |
2422 uncovered_files=set(['foo/xyz.cc']), | 2422 uncovered_files=set(['foo/xyz.cc', 'foo/bar.cc']), |
2423 expected_output='Missing LGTM from an OWNER ' | 2423 expected_output='Missing LGTM from an OWNER ' |
2424 'for these files:\n foo/xyz.cc\n', | 2424 'for these files:\n' |
| 2425 ' foo/bar.cc\n' |
| 2426 ' foo/xyz.cc\n', |
2425 author_counts_as_owner=False) | 2427 author_counts_as_owner=False) |
2426 | 2428 |
2427 def testCannedCheckOwners_TBR(self): | 2429 def testCannedCheckOwners_TBR(self): |
2428 self.AssertOwnersWorks(tbr=True, | 2430 self.AssertOwnersWorks(tbr=True, |
2429 expected_output='--tbr was specified, skipping OWNERS check\n') | 2431 expected_output='--tbr was specified, skipping OWNERS check\n') |
2430 self.AssertOwnersWorks(tbr=True, is_committing=False, expected_output='') | 2432 self.AssertOwnersWorks(tbr=True, is_committing=False, expected_output='') |
2431 | 2433 |
2432 def testCannedCheckOwners_WithoutOwnerLGTM(self): | 2434 def testCannedCheckOwners_WithoutOwnerLGTM(self): |
2433 self.AssertOwnersWorks(uncovered_files=set(['foo']), | 2435 self.AssertOwnersWorks(uncovered_files=set(['foo']), |
2434 expected_output='Missing LGTM from an OWNER for these files:\n' | 2436 expected_output='Missing LGTM from an OWNER for these files:\n' |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2535 owners_check=False) | 2537 owners_check=False) |
2536 self.assertEqual(1, len(results)) | 2538 self.assertEqual(1, len(results)) |
2537 self.assertEqual( | 2539 self.assertEqual( |
2538 'Found line ending with white spaces in:', results[0]._message) | 2540 'Found line ending with white spaces in:', results[0]._message) |
2539 self.checkstdout('') | 2541 self.checkstdout('') |
2540 | 2542 |
2541 | 2543 |
2542 if __name__ == '__main__': | 2544 if __name__ == '__main__': |
2543 import unittest | 2545 import unittest |
2544 unittest.main() | 2546 unittest.main() |
OLD | NEW |