def call_main(args): # Get output directory. try: if args.output_dir is not None: runtime.set_output_dir(args.output_dir) except ValueError as e: print str(e) raise # Set up logging. setup_logging(runtime.get_output_dir(), args.log_level, args.console_level) logger = logging.getLogger("zopkio") logger.info("Starting zopkio") try: utils.check_file_with_exception(args.testfile) utils.check_testfile_dir_structure(args.testfile) machines = utils.make_machine_mapping(args.machine_list) config_overrides = utils.parse_config_list(args.config_overrides) except ValueError as e: logger.error(str(e)) print("Error in processing command line arguments:\n {0}".format( traceback.format_exc())) raise runtime.set_machines(machines) if args.user is not None: user = args.user else: user = getpass.getuser() if args.nopassword: password = "" else: password = getpass.getpass() runtime.set_user(user, password) try: testmodule = utils.load_module(args.testfile) ztestsuites = [ getattr(testmodule, attr) for attr in dir(testmodule) if isinstance(getattr(testmodule, attr), ZTestSuite) ] if len( ztestsuites ) > 0: #TODO(jehrlich) intelligently handle multiple test suites test_runner = TestRunner(ztestsuite=ztestsuites[0], testlist=args.test_list, config_overrides=config_overrides) else: test_runner = TestRunner(args.testfile, args.test_list, config_overrides) except BaseException as e: print("Error setting up testrunner:\n%s" % traceback.format_exc()) raise ValueError(e.message) test_runner.run() logger.info("Exiting zopkio") return test_runner.success_count(), test_runner.fail_count()
def call_main(args): # Get output directory. try: if args.output_dir is not None: runtime.set_output_dir(args.output_dir) except ValueError as e: print str(e) raise # Set up logging. setup_logging(runtime.get_output_dir(), args.log_level, args.console_level) logger = logging.getLogger("zopkio") logger.info("Starting zopkio") try: utils.check_file_with_exception(args.testfile) utils.check_testfile_dir_structure(args.testfile) machines = utils.make_machine_mapping(args.machine_list) config_overrides = utils.parse_config_list(args.config_overrides) except ValueError as e: logger.error(str(e)) print("Error in processing command line arguments:\n {0}".format(traceback.format_exc())) raise runtime.set_machines(machines) if args.user is not None: user = args.user else: user = getpass.getuser() if args.nopassword: password = "" else: password = getpass.getpass() runtime.set_user(user, password) try: testmodule = utils.load_module(args.testfile) ztestsuites = [getattr(testmodule, attr) for attr in dir(testmodule) if isinstance(getattr(testmodule, attr), ZTestSuite)] if len(ztestsuites) > 0: #TODO(jehrlich) intelligently handle multiple test suites test_runner = TestRunner(ztestsuite=ztestsuites[0], testlist=args.test_list, config_overrides=config_overrides) else: test_runner = TestRunner(args.testfile, args.test_list, config_overrides) except BaseException as e: print("Error setting up testrunner:\n%s" % traceback.format_exc()) raise ValueError(e.message) test_runner.run() logger.info("Exiting zopkio") return test_runner.success_count(), test_runner.fail_count()