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

Side by Side Diff: tests/presubmit_unittest.py

Issue 1449853002: depot_tools: make CheckLicense warn instead of notify (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 5 years, 1 month 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 | « presubmit_canned_checks.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
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 StringIO 10 import StringIO
(...skipping 2306 matching lines...) Expand 10 before | Expand all | Expand 10 after
2317 "#!/bin/python\n" 2317 "#!/bin/python\n"
2318 "# Copyright (c) 2037 Nobody.\n" 2318 "# Copyright (c) 2037 Nobody.\n"
2319 "# All Rights Reserved.\n" 2319 "# All Rights Reserved.\n"
2320 "print 'foo'\n" 2320 "print 'foo'\n"
2321 ) 2321 )
2322 license_text = ( 2322 license_text = (
2323 r".*? Copyright \(c\) 0007 Nobody." "\n" 2323 r".*? Copyright \(c\) 0007 Nobody." "\n"
2324 r".*? All Rights Reserved\." "\n" 2324 r".*? All Rights Reserved\." "\n"
2325 ) 2325 )
2326 self._LicenseCheck(text, license_text, False, 2326 self._LicenseCheck(text, license_text, False,
2327 presubmit.OutputApi.PresubmitNotifyResult) 2327 presubmit.OutputApi.PresubmitPromptWarning)
2328 2328
2329 def testCheckLicenseEmptySuccess(self): 2329 def testCheckLicenseEmptySuccess(self):
2330 text = '' 2330 text = ''
2331 license_text = ( 2331 license_text = (
2332 r".*? Copyright \(c\) 2037 Nobody." "\n" 2332 r".*? Copyright \(c\) 2037 Nobody." "\n"
2333 r".*? All Rights Reserved\." "\n" 2333 r".*? All Rights Reserved\." "\n"
2334 ) 2334 )
2335 self._LicenseCheck(text, license_text, True, None, accept_empty_files=True) 2335 self._LicenseCheck(text, license_text, True, None, accept_empty_files=True)
2336 2336
2337 def testCannedCheckSvnAccidentalSubmission(self): 2337 def testCannedCheckSvnAccidentalSubmission(self):
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
2914 owners_check=False) 2914 owners_check=False)
2915 self.assertEqual(2, len(results)) 2915 self.assertEqual(2, len(results))
2916 self.assertEqual( 2916 self.assertEqual(
2917 'Found line ending with white spaces in:', results[0]._message) 2917 'Found line ending with white spaces in:', results[0]._message)
2918 self.checkstdout('') 2918 self.checkstdout('')
2919 2919
2920 2920
2921 if __name__ == '__main__': 2921 if __name__ == '__main__':
2922 import unittest 2922 import unittest
2923 unittest.main() 2923 unittest.main()
OLDNEW
« no previous file with comments | « presubmit_canned_checks.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698