Print effective NO_CHECK_IMPORTS.
Note: mandatory check (NEED_CHECK) was skipped
@@ -24,6 +24,8 @@ def check_imports(no_check=(), extra=(), skip_func=None):
exceptions = list(no_check)
for key, _ in __res.iter_keys(b'py/no_check_imports/'):
exceptions += str_(__res.find(key)).split()
+ exceptions.sort()
+ print('NO_CHECK_IMPORTS', ' '.join(exceptions))
patterns = [re.escape(s).replace(r'\*', r'.*') for s in exceptions]
rx = re.compile('^({})$'.format('|'.join(patterns)))
@@ -33,26 +35,26 @@ def check_imports(no_check=(), extra=(), skip_func=None):
norm = lambda s: s[:-9] if s.endswith('.__init__') else s
for module in sorted(sys.extra_modules | set(extra), key=norm):
if module not in extra and (rx.search(module) or skip_func and skip_func(module)):
- print('SKIP:', module)
+ print('SKIP', module)
continue
name = module.rsplit('.', 1)[-1]
if name == '__main__' and 'if __name__ ==' not in importer.get_source(module):
- print('SKIP:', module, '''without "if __name__ == '__main__'" check''')
+ print('SKIP', module, '''without "if __name__ == '__main__'" check''')
continue
try:
- print('TRY:', module)
+ print('TRY', module)
if module == '__main__':
importer.load_module('__main__', '__main__py')
elif module.endswith('.__init__'):
__import__(module[:-len('.__init__')])
else:
__import__(module)
- print('OK:', module)
+ print('OK ', module)
except Exception as e:
- print('FAIL:', module, e, file=sys.stderr)
+ print('FAIL', module, e, file=sys.stderr)
traceback.print_exception(*sys.exc_info())
failed.append('{}: {}'.format(module, e))
@@ -65,7 +67,6 @@ test_imports = check_imports
def main():
skip_names = sys.argv[1:]
- print("Skip patterns:", skip_names)
os.environ['Y_PYTHON_IMPORT_TEST'] = ''
try:
