Commit bdcdc59c authored by anatoly techtonik's avatar anatoly techtonik Committed by Commit Bot

Fix pylint file list matching on Windows

Windows paths use backward slash separator, which
escapes regular expressions for white and black lists
in PRESUBMIT.py filters

See https://goo.gl/6c7aku for discussion

Bug:

Change-Id: Ia1d133c5b6cfa6cb364b1500b7b7abe583bce346
Reviewed-on: https://chromium-review.googlesource.com/461141
Commit-Queue: Marc-Antoine Ruel <maruel@chromium.org>
Reviewed-by: 's avatarMarc-Antoine Ruel <maruel@chromium.org>
parent af0fd4eb
......@@ -525,7 +525,8 @@ def GetUnitTestsInDirectory(
continue
unit_tests.append(input_api.os_path.join(directory, filename))
to_run += 1
input_api.logging.debug('Found %d files, running %d' % (found, to_run))
input_api.logging.debug('Found %d files, running %d unit tests'
% (found, to_run))
if not to_run:
return [
output_api.PresubmitPromptWarning(
......@@ -675,6 +676,9 @@ def _FetchAllFiles(input_api, white_list, black_list):
# can break another unmodified file.
# Use code similar to InputApi.FilterSourceFile()
def Find(filepath, filters):
if input_api.platform == 'win32':
filepath = filepath.replace('\\', '/')
for item in filters:
if input_api.re.match(item, filepath):
return True
......
......@@ -2627,7 +2627,7 @@ class CannedChecksUnittest(PresubmitTestsBase):
input_api,
[presubmit.os.path.join('random_directory', 'b'), '--verbose'],
cwd=self.fake_root_dir)
input_api.logging.debug('Found 5 files, running 1')
input_api.logging.debug('Found 5 files, running 1 unit tests')
self.mox.ReplayAll()
results = presubmit_canned_checks.RunUnitTestsInDirectory(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment