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

Unified Diff: tests/presubmit_unittest.py

Issue 4310001: Make CheckLicense() to not trigger on empty files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « presubmit_canned_checks.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/presubmit_unittest.py
diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py
index 4a8ad588cc6c3dd89a565bf58daf10cefba98c02..f6880025e0790d3d44a967d9cbe14787365536f5 100755
--- a/tests/presubmit_unittest.py
+++ b/tests/presubmit_unittest.py
@@ -1386,7 +1386,7 @@ class CannedChecksUnittest(PresubmitTestsBase):
'svn:eol-style', 'LF', '', False,
presubmit.OutputApi.PresubmitNotifyResult, True)
- def _LicenseCheck(self, text, license, committing, expected_result):
+ def _LicenseCheck(self, text, license, committing, expected_result, **kwargs):
change = self.mox.CreateMock(presubmit.SvnChange)
change.scm = 'svn'
input_api = self.MockInputApi(change, committing)
@@ -1398,7 +1398,8 @@ class CannedChecksUnittest(PresubmitTestsBase):
self.mox.ReplayAll()
result = presubmit_canned_checks.CheckLicense(
- input_api, presubmit.OutputApi, license, 42)
+ input_api, presubmit.OutputApi, license, source_file_filter=42,
+ **kwargs)
if expected_result:
self.assertEqual(len(result), 1)
self.assertEqual(result[0].__class__, expected_result)
@@ -1446,6 +1447,14 @@ class CannedChecksUnittest(PresubmitTestsBase):
self._LicenseCheck(text, license, False,
presubmit.OutputApi.PresubmitNotifyResult)
+ def testCheckLicenseEmptySuccess(self):
+ text = ''
+ license = (
+ r".*? Copyright \(c\) 2037 Nobody." "\n"
+ r".*? All Rights Reserved\." "\n"
+ )
+ self._LicenseCheck(text, license, True, None, accept_empty_files=True)
+
def testCannedCheckSvnAccidentalSubmission(self):
modified_dir_file = 'foo/'
accidental_submssion_file = 'foo/bar.cc'
« 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