blob: 1cd25f92e22def17a6fef02c8bd59820ac528244 [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.
asanka234b8d22015-06-26 22:40:234"""Presubmit tests for /tools/vim.
5
6Runs Python unit tests in /tools/vim/tests on upload.
7"""
8
asankac68cb712017-03-11 17:53:539
asanka234b8d22015-06-26 22:40:2310def 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())
asankac68cb712017-03-11 17:53:5317 for f in input_api.AbsoluteLocalPaths()
18 ]
asanka167e1ea2015-11-21 02:08:0319
20 # Run the chromium.ycm_extra_conf_unittest test if the YCM config file is
21 # changed or if any change is affecting the tests directory. This specific
22 # test requires access to 'ninja' and hasn't been tested on platforms other
23 # than Linux.
24 if 'chromium.ycm_extra_conf.py' in affected_files or \
lstorsetf7a91ff2015-11-25 15:10:5825 'ninja_output.py' in affected_files or \
asanka167e1ea2015-11-21 02:08:0326 any([input_api.re.match(r'tests(/|\\)',f) for f in affected_files]):
27 results += input_api.RunTests(
asankac68cb712017-03-11 17:53:5328 input_api.canned_checks.GetUnitTests(input_api, output_api, [
29 'tests/chromium.ycm_extra_conf_unittest.py'
30 ]))
asanka167e1ea2015-11-21 02:08:0331
32 return results