From b0d5a2100e121d8c7109c721ec160544fd55005e Mon Sep 17 00:00:00 2001 From: Martin DeMello Date: Thu, 8 Mar 2018 15:37:45 -0800 Subject: [PATCH] add progress monitoring (#1945) --- tests/pytype_test.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/pytype_test.py b/tests/pytype_test.py index 5d7ba17a7..71e7e7dc6 100755 --- a/tests/pytype_test.py +++ b/tests/pytype_test.py @@ -141,6 +141,7 @@ def can_run(path, exe, *args): except OSError: return False + def pytype_test(args): dirs = get_project_dirs(args) pytype_exe = os.path.join(dirs.pytype, 'pytype') @@ -159,6 +160,11 @@ def pytype_test(args): print('Cannot run pytd. Did you install pytype?') return 0, 0 + if not can_run('', args.python36_exe, '--version'): + print('Cannot run python3.6 from %s. (point to a valid executable via ' + '--python36_exe)' % args.python36_exe) + return 0, 0 + wanted = re.compile(r'stdlib/.*\.pyi$') skip, parse_only = load_blacklist(dirs) skipped = PathMatcher(skip) @@ -181,6 +187,8 @@ def pytype_test(args): running_tests = collections.deque() max_code, runs, errors = 0, 0, 0 files = pytype_run + pytd_run + total_files = len(files) + print("Testing files with pytype...") while 1: while files and len(running_tests) < args.num_parallel: f = files.pop() @@ -222,6 +230,9 @@ def pytype_test(args): bad.append((_get_relative(test_run.args[-1]), stderr.rstrip().rsplit('\n', 1)[-1])) + if runs % 25 == 0: + print(" %3d/%d with %3d errors" % (runs, total_files, errors)) + print('Ran pytype with %d pyis, got %d errors.' % (runs, errors)) for f, err in bad: print('%s: %s' % (f, err))