blob: 66d4f117bf71ab7b0149f68c26771577b1550999 [file] [log] [blame]
Avi Drissmandfd880852022-09-15 20:11:091# Copyright 2015 The Chromium Authors
dpranke1d306312015-08-11 21:17:332# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
Keren Zhuc96dacd2021-06-29 00:03:445
Garrett Beatyb97c96972024-01-02 22:25:176PRESUBMIT_VERSION = '2.0.0'
7
dpranke1d306312015-08-11 21:17:338
Garrett Beatyac48e8c92021-12-14 01:28:489def CheckFreeze(input_api, output_api):
Garrett Beatyee198432024-01-25 00:08:4110 return input_api.canned_checks.CheckInfraFreeze(input_api, output_api)
Garrett Beatyac48e8c92021-12-14 01:28:4811
12
13def CheckTests(input_api, output_api):
Garrett Beatyb97c96972024-01-02 22:25:1714 return input_api.RunTests(
Takuto Ikutae108f102023-06-01 21:38:3015 input_api.canned_checks.GetUnitTestsInDirectory(input_api, output_api,
Jonathan Njeunjee45f2bd2021-10-12 16:21:5816 '.',
Garrett Beatyb97c96972024-01-02 22:25:1717 [r'.+_(unit)?test\.py$']))
dpranke1d306312015-08-11 21:17:3318
Garrett Beatyb97c96972024-01-02 22:25:1719
20def CheckPylint(input_api, output_api):
21 return input_api.canned_checks.RunPylint(
22 input_api,
23 output_api,
24 version='2.7',
25 # pylint complains about Checkfreeze not being defined, its probably
26 # finding a different PRESUBMIT.py. Note that this warning only
27 # appears if the number of Pylint jobs is greater than one.
28 files_to_skip=['PRESUBMIT_test.py'],
29 # Disabling this warning because this pattern involving ToSrcRelPath
30 # seems intrinsic to how mb_unittest.py is implemented.
31 disabled_warnings=[
32 'attribute-defined-outside-init',
33 ],
34 )
35
36
37def CheckMbValidate(input_api, output_api):
Ben Pastened512e092022-04-29 21:48:5138 cmd = [input_api.python3_executable, 'mb.py', 'validate']
dprankea33267872015-08-12 15:45:1739 kwargs = {'cwd': input_api.PresubmitLocalPath()}
Garrett Beatyb97c96972024-01-02 22:25:1740 return input_api.RunTests([
dprankea33267872015-08-12 15:45:1741 input_api.Command(name='mb_validate',
Erik Staabab20a092022-12-13 23:36:0942 cmd=cmd,
43 kwargs=kwargs,
Garrett Beatyb97c96972024-01-02 22:25:1744 message=output_api.PresubmitError),
45 ])