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

Unified Diff: tests/presubmit_unittest.py

Issue 7104141: Use tuple everywhere with explicit conversion. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: fix tuple Created 9 years, 6 months 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 01f8a4331a2fc2c92757c0c41d029f740f71b98d..5f87a742ecc09a83b232ac5ebd86e7f125a42262 100755
--- a/tests/presubmit_unittest.py
+++ b/tests/presubmit_unittest.py
@@ -10,6 +10,7 @@
import StringIO
import sys
+import time
# Fixes include path.
from super_mox import mox, SuperMoxTestBase
@@ -1361,6 +1362,8 @@ class CannedChecksUnittest(PresubmitTestsBase):
input_api.tbr = False
input_api.python_executable = 'pyyyyython'
input_api.platform = sys.platform
+ input_api.time = time
+ input_api.canned_checks = presubmit_canned_checks
return input_api
def testMembersChanged(self):
@@ -2157,6 +2160,44 @@ mac|success|blew
self.checkstdout(
'Running %s\n' % presubmit.os.path.join('random_directory', 'b'))
+ def testPanProjectChecks(self):
+ # Make sure it accepts both list and tuples.
+ change = presubmit.Change(
+ 'foo1', 'description1', self.fake_root_dir, None, 0, 0, None)
+ input_api = self.MockInputApi(change, False)
+ affected_file = self.mox.CreateMock(presubmit.SvnAffectedFile)
+ for _ in range(3):
+ input_api.AffectedFiles(file_filter=mox.IgnoreArg(), include_deletes=False
+ ).AndReturn([affected_file])
+ affected_file.NewContents().AndReturn('Hey!\nHo!\nHey!\nHo!\n\n')
+ affected_file.ChangedContents().AndReturn([
+ (0, 'Hey!\n'),
+ (1, 'Ho!\n'),
+ (2, 'Hey!\n'),
+ (3, 'Ho!\n'),
+ (4, '\n')])
+ for _ in range(5):
+ affected_file.LocalPath().AndReturn('hello.py')
+ input_api.AffectedSourceFiles(mox.IgnoreArg()).AndReturn([affected_file])
+ input_api.ReadFile(affected_file).AndReturn('Hey!\nHo!\nHey!\nHo!\n\n')
+ input_api.AffectedSourceFiles(mox.IgnoreArg()).AndReturn([affected_file])
+ for _ in range(4):
+ affected_file.LocalPath().AndReturn('hello.py')
+
+ self.mox.ReplayAll()
+ results = presubmit_canned_checks.PanProjectChecks(
+ input_api,
+ presubmit.OutputApi,
+ excluded_paths=None,
+ text_files=None,
+ license_header=None,
+ project_name=None,
+ owners_check=True)
+ self.assertEqual(1, len(results))
+ self.assertEqual(
+ 'Found line ending with white spaces in:', results[0]._message)
+ self.checkstdout('')
+
if __name__ == '__main__':
import unittest
« 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