PRESUBMIT.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Copyright (c) 2013 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. """Presubmit script for build/chromeos/.
  5. See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
  6. details on the presubmit API built into depot_tools.
  7. """
  8. USE_PYTHON3 = True
  9. def CommonChecks(input_api, output_api):
  10. results = []
  11. # These tests don't run on Windows and give verbose and cryptic failure
  12. # messages. Linting the code on a platform where it will not run is also not
  13. # valuable and gives spurious errors.
  14. if input_api.sys.platform != 'win32':
  15. results += input_api.canned_checks.RunPylint(
  16. input_api, output_api, pylintrc='pylintrc', version='2.6')
  17. tests = input_api.canned_checks.GetUnitTestsInDirectory(
  18. input_api,
  19. output_api,
  20. '.', [r'^.+_test\.py$'],
  21. run_on_python2=False,
  22. run_on_python3=True,
  23. skip_shebang_check=True)
  24. results += input_api.RunTests(tests)
  25. return results
  26. def CheckChangeOnUpload(input_api, output_api):
  27. return CommonChecks(input_api, output_api)
  28. def CheckChangeOnCommit(input_api, output_api):
  29. return CommonChecks(input_api, output_api)