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

Unified Diff: presubmit_support.py

Issue 114082: Improve the presubmit_canned_checks testing by using a real mock and testing for more cases. (Closed)
Patch Set: bump version Created 11 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') | tests/presubmit_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: presubmit_support.py
diff --git a/presubmit_support.py b/presubmit_support.py
index f12d31294f4b3abf9f4e4e7892ca1c5e34aa2f7e..928929e35f74554d6126816d9d46945077034b0b 100755
--- a/presubmit_support.py
+++ b/presubmit_support.py
@@ -6,7 +6,7 @@
"""Enables directory-specific presubmit checks to run at upload and/or commit.
"""
-__version__ = '1.1'
+__version__ = '1.2'
# TODO(joi) Add caching where appropriate/needed. The API is designed to allow
# caching (between all different invocations of presubmit scripts for a given
@@ -26,6 +26,7 @@ import subprocess # Exposed through the API.
import sys # Parts exposed through API.
import tempfile # Exposed through the API.
import types
+import unittest # Exposed through the API.
import urllib2 # Exposed through the API.
import warnings
@@ -172,6 +173,7 @@ class InputApi(object):
self.re = re
self.subprocess = subprocess
self.tempfile = tempfile
+ self.unittest = unittest
self.urllib2 = urllib2
# InputApi.platform is the platform you're currently running on.
@@ -273,6 +275,8 @@ class InputApi(object):
the AffectedFile instance of the current file;
integer line number (1-based); and
the contents of the line as a string.
+
+ Note: The cariage return (LF or CR) is stripped off.
"""
return InputApi._RightHandSideLinesImpl(
filter(lambda x: x.IsTextFile(),
@@ -349,6 +353,7 @@ class AffectedFile(object):
side".
Contents will be empty if the file is a directory or does not exist.
+ Note: The cariage returns (LF or CR) are stripped off.
"""
if self.IsDirectory():
return []
« no previous file with comments | « presubmit_canned_checks.py ('k') | tests/presubmit_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698