From 091b7db64c188eb497cb2092321c11564edaf1ea Mon Sep 17 00:00:00 2001 From: dcheng Date: Thu, 16 Jun 2016 01:27:51 -0700 Subject: [PATCH] Expose fnmatch in presubmit's input_api. BUG=611905 Review-Url: https://codereview.chromium.org/2070493002 --- presubmit_support.py | 3 +- tests/presubmit_unittest.py | 65 ++++++++++++++++++++++++++++++------- 2 files changed, 55 insertions(+), 13 deletions(-) diff --git a/presubmit_support.py b/presubmit_support.py index 249ec09367..4f72d5c860 100755 --- a/presubmit_support.py +++ b/presubmit_support.py @@ -16,7 +16,7 @@ import cpplint import cPickle # Exposed through the API. import cStringIO # Exposed through the API. import contextlib -import fnmatch +import fnmatch # Exposed through the API. import glob import inspect import itertools @@ -348,6 +348,7 @@ class InputApi(object): self.cPickle = cPickle self.cpplint = cpplint self.cStringIO = cStringIO + self.fnmatch = fnmatch self.glob = glob.glob self.json = json self.logging = logging.getLogger('PRESUBMIT') diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py index 7b13102934..2863c1446c 100755 --- a/tests/presubmit_unittest.py +++ b/tests/presubmit_unittest.py @@ -1190,17 +1190,58 @@ class InputApiUnittest(PresubmitTestsBase): def testMembersChanged(self): self.mox.ReplayAll() members = [ - 'AbsoluteLocalPaths', 'AffectedFiles', 'AffectedSourceFiles', - 'AffectedTextFiles', 'DEFAULT_BLACK_LIST', 'DEFAULT_WHITE_LIST', - 'DepotToLocalPath', 'FilterSourceFile', 'LocalPaths', 'LocalToDepotPath', - 'Command', 'RunTests', 'PresubmitLocalPath', 'ReadFile', - 'RightHandSideLines', 'ServerPaths', 'basename', 'cPickle', 'cpplint', - 'cStringIO', 'canned_checks', 'change', 'cpu_count', 'environ', 'glob', - 'host_url', 'is_committing', 'json', 'logging', 'marshal', 'os_listdir', - 'os_walk', 'os_path', 'os_stat', 'owners_db', 'pickle', 'platform', - 'python_executable', 're', 'rietveld', 'subprocess', 'tbr', 'tempfile', - 'time', 'traceback', 'unittest', 'urllib2', 'version', 'verbose', - 'dry_run', 'gerrit', + 'AbsoluteLocalPaths', + 'AffectedFiles', + 'AffectedSourceFiles', + 'AffectedTextFiles', + 'DEFAULT_BLACK_LIST', + 'DEFAULT_WHITE_LIST', + 'DepotToLocalPath', + 'FilterSourceFile', + 'LocalPaths', + 'LocalToDepotPath', + 'Command', + 'RunTests', + 'PresubmitLocalPath', + 'ReadFile', + 'RightHandSideLines', + 'ServerPaths', + 'basename', + 'cPickle', + 'cpplint', + 'cStringIO', + 'canned_checks', + 'change', + 'cpu_count', + 'environ', + 'fnmatch', + 'glob', + 'host_url', + 'is_committing', + 'json', + 'logging', + 'marshal', + 'os_listdir', + 'os_walk', + 'os_path', + 'os_stat', + 'owners_db', + 'pickle', + 'platform', + 'python_executable', + 're', + 'rietveld', + 'subprocess', + 'tbr', + 'tempfile', + 'time', + 'traceback', + 'unittest', + 'urllib2', + 'version', + 'verbose', + 'dry_run', + 'gerrit', ] # If this test fails, you should add the relevant test. self.compareMembers( @@ -2735,7 +2776,7 @@ class CannedChecksUnittest(PresubmitTestsBase): "sender": "ben@example.com", "text": "foo", "approval": False, }, ], - "reviewers":[], + "reviewers": [], } self.AssertOwnersWorks( approvers=set(),