Fix test for missing __init__.py for modules.

pull/25930/head
Matt Clay 8 years ago
parent e747650543
commit 75a3ac5ca5

@ -1140,6 +1140,8 @@ def main():
reporter = Reporter() reporter = Reporter()
git_cache = GitCache(args.base_branch) git_cache = GitCache(args.base_branch)
check_dirs = set()
for module in args.modules: for module in args.modules:
if os.path.isfile(module): if os.path.isfile(module):
path = module path = module
@ -1150,6 +1152,7 @@ def main():
with ModuleValidator(path, analyze_arg_spec=args.arg_spec, with ModuleValidator(path, analyze_arg_spec=args.arg_spec,
base_branch=args.base_branch, git_cache=git_cache, reporter=reporter) as mv: base_branch=args.base_branch, git_cache=git_cache, reporter=reporter) as mv:
mv.validate() mv.validate()
check_dirs.add(os.path.dirname(path))
for root, dirs, files in os.walk(module): for root, dirs, files in os.walk(module):
basedir = root[len(module) + 1:].split('/', 1)[0] basedir = root[len(module) + 1:].split('/', 1)[0]
@ -1161,8 +1164,7 @@ def main():
path = os.path.join(root, dirname) path = os.path.join(root, dirname)
if args.exclude and args.exclude.search(path): if args.exclude and args.exclude.search(path):
continue continue
pv = PythonPackageValidator(path, reporter=reporter) check_dirs.add(path)
pv.validate()
for filename in files: for filename in files:
path = os.path.join(root, filename) path = os.path.join(root, filename)
@ -1174,6 +1176,10 @@ def main():
base_branch=args.base_branch, git_cache=git_cache, reporter=reporter) as mv: base_branch=args.base_branch, git_cache=git_cache, reporter=reporter) as mv:
mv.validate() mv.validate()
for path in sorted(check_dirs):
pv = PythonPackageValidator(path, reporter=reporter)
pv.validate()
if args.format == 'plain': if args.format == 'plain':
sys.exit(reporter.plain(warnings=args.warnings, output=args.output)) sys.exit(reporter.plain(warnings=args.warnings, output=args.output))
else: else:

Loading…
Cancel
Save