add progress monitoring (#1945)

This commit is contained in:
Martin DeMello
2018-03-08 15:37:45 -08:00
committed by Matthias Kramm
parent ef87943397
commit b0d5a2100e

View File

@@ -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))