run_pytype.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/env vpython3
  2. # Copyright 2022 The Chromium Authors. All rights reserved.
  3. # Use of this source code is governed by a BSD-style license that can be
  4. # found in the LICENSE file.
  5. """Simple helper script to run pytype on //testing code."""
  6. import os
  7. import sys
  8. from pytype_common import pytype_runner
  9. TESTING_DIR = os.path.abspath(os.path.dirname(__file__))
  10. CHROMIUM_SRC_DIR = os.path.realpath(os.path.join(TESTING_DIR, '..'))
  11. EXTRA_PATHS_COMPONENTS = [
  12. ('third_party', 'catapult', 'third_party', 'typ'),
  13. ]
  14. EXTRA_PATHS = [
  15. os.path.join(CHROMIUM_SRC_DIR, *p) for p in EXTRA_PATHS_COMPONENTS
  16. ]
  17. EXTRA_PATHS.append(TESTING_DIR)
  18. FILES_AND_DIRECTORIES_TO_CHECK = [
  19. 'unexpected_passes_common',
  20. ]
  21. FILES_AND_DIRECTORIES_TO_CHECK = [
  22. os.path.join(TESTING_DIR, f) for f in FILES_AND_DIRECTORIES_TO_CHECK
  23. ]
  24. TEST_NAME = 'testing_pytype'
  25. TEST_LOCATION = "//testing/run_pytype.py"
  26. def main() -> int:
  27. return pytype_runner.run_pytype(TEST_NAME, TEST_LOCATION,
  28. FILES_AND_DIRECTORIES_TO_CHECK,
  29. EXTRA_PATHS, TESTING_DIR)
  30. if __name__ == '__main__':
  31. sys.exit(main())