(input_api, output_api)
| 9 | |
| 10 | |
| 11 | def _CommonChecks(input_api, output_api): |
| 12 | results = [] |
| 13 | |
| 14 | # Run Pylint over the files in the directory. |
| 15 | pylint_checks = input_api.canned_checks.GetPylint(input_api, output_api) |
| 16 | results.extend(input_api.RunTests(pylint_checks)) |
| 17 | |
| 18 | # Run the MB unittests. |
| 19 | results.extend( |
| 20 | input_api.canned_checks.RunUnitTestsInDirectory(input_api, output_api, |
| 21 | '.', [r'^.+_test\.py$'], |
| 22 | run_on_python2=False)) |
| 23 | |
| 24 | # Validate the format of the mb_config.pyl file. |
| 25 | cmd = [input_api.python3_executable, 'mb.py', 'validate'] |
| 26 | kwargs = {'cwd': input_api.PresubmitLocalPath()} |
| 27 | results.extend(input_api.RunTests([ |
| 28 | input_api.Command(name='mb_validate', |
| 29 | cmd=cmd, kwargs=kwargs, |
| 30 | message=output_api.PresubmitError, |
| 31 | python3=True)])) |
| 32 | |
| 33 | is_mb_config = (lambda filepath: 'mb_config.pyl' in filepath.LocalPath()) |
| 34 | results.extend( |
| 35 | input_api.canned_checks.CheckLongLines( |
| 36 | input_api, output_api, maxlen=80, source_file_filter=is_mb_config)) |
| 37 | |
| 38 | return results |
| 39 | |
| 40 | |
| 41 | def CheckChangeOnUpload(input_api, output_api): |
no test coverage detected