PRESUBMIT.py 739 B

12345678910111213141516171819202122232425
  1. # Copyright 2019 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. USE_PYTHON3 = True
  5. def CheckChangeOnUpload(*args):
  6. return _CommonChecks(*args)
  7. def CheckChangeOnCommit(*args):
  8. return _CommonChecks(*args)
  9. def _CommonChecks(input_api, output_api):
  10. cwd = input_api.PresubmitLocalPath()
  11. path = input_api.os_path
  12. files = [path.basename(f.LocalPath()) for f in input_api.AffectedFiles()]
  13. if any(f for f in files if f.startswith('clean_json_attrs')):
  14. tests = [path.join(cwd, 'clean_json_attrs_test.py')]
  15. return input_api.canned_checks.RunUnitTests(
  16. input_api, output_api, tests, run_on_python2=False)
  17. return []