• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env vpython3
2# Copyright 2022 The Chromium Authors
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
7import os
8import sys
9
10from pytype_common import pytype_runner
11
12TESTING_DIR = os.path.abspath(os.path.dirname(__file__))
13CHROMIUM_SRC_DIR = os.path.realpath(os.path.join(TESTING_DIR, '..'))
14
15EXTRA_PATHS_COMPONENTS = [
16    ('third_party', 'catapult', 'third_party', 'typ'),
17]
18EXTRA_PATHS = [
19    os.path.join(CHROMIUM_SRC_DIR, *p) for p in EXTRA_PATHS_COMPONENTS
20]
21EXTRA_PATHS.append(TESTING_DIR)
22
23FILES_AND_DIRECTORIES_TO_CHECK = [
24    'unexpected_passes_common',
25    'flake_suppressor_common',
26]
27FILES_AND_DIRECTORIES_TO_CHECK = [
28    os.path.join(TESTING_DIR, f) for f in FILES_AND_DIRECTORIES_TO_CHECK
29]
30
31TEST_NAME = 'testing_pytype'
32TEST_LOCATION = "//testing/run_pytype.py"
33
34
35def main() -> int:
36    return pytype_runner.run_pytype(TEST_NAME, TEST_LOCATION,
37                                    FILES_AND_DIRECTORIES_TO_CHECK,
38                                    EXTRA_PATHS, TESTING_DIR)
39
40
41if __name__ == '__main__':
42    sys.exit(main())