blob: 33cdd6d82bc4b80468b15d9f0d983acb892d35a1 [file] [log] [blame]
asanka234b8d22015-06-26 22:40:231# Copyright 2015 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5"""Presubmit tests for /tools/vim.
6
7Runs Python unit tests in /tools/vim/tests on upload.
8"""
9
10def CheckChangeOnUpload(input_api, output_api):
asanka167e1ea2015-11-21 02:08:0311 results = []
12
13 # affected_files is list of files affected by this change. The paths are
14 # relative to the directory containing PRESUBMIT.py.
15 affected_files = [
16 input_api.os_path.relpath(f, input_api.PresubmitLocalPath())
17 for f in input_api.AbsoluteLocalPaths()]
18
19 # Run the chromium.ycm_extra_conf_unittest test if the YCM config file is
20 # changed or if any change is affecting the tests directory. This specific
21 # test requires access to 'ninja' and hasn't been tested on platforms other
22 # than Linux.
23 if 'chromium.ycm_extra_conf.py' in affected_files or \
lstorsetf7a91ff2015-11-25 15:10:5824 'ninja_output.py' in affected_files or \
asanka167e1ea2015-11-21 02:08:0325 any([input_api.re.match(r'tests(/|\\)',f) for f in affected_files]):
26 results += input_api.RunTests(
27 input_api.canned_checks.GetUnitTests(
28 input_api, output_api,
29 ['tests/chromium.ycm_extra_conf_unittest.py']))
30
31 return results