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