def main(): options = parse_args() # We add path to the pytype package at the beginning of sys.path so that # it gets picked up before other potential pytype installations present # already. sys.path = [options.pytype_path] + sys.path stats_collector = StatsCollector(options) reporter = ResultReporter(options, stats_collector) def run(output_file): options.output_file = output_file result = run_tests_in_module(options, reporter) stats_collector.report() return result if options.output: with open(options.output, "w") as output_file: result = run(output_file) else: result = run(None) if result != 0: print(build_utils.failure_msg(options.fq_mod_name, options.output)) sys.exit(1) else: print(build_utils.pass_msg(options.fq_mod_name))
def main(): options = parse_args() returncode, stdout = build_utils.run_cmd([options.binary]) if options.logfile: with open(options.logfile, "w") as logfile: logfile.write(stdout) if returncode == 0: print(build_utils.pass_msg(options.target)) else: print(build_utils.failure_msg(options.target, options.logfile)) sys.exit(1)