def ProcessMonkeyTestOptions(options, error_func): """Processes all monkey test options. Args: options: optparse.Options object. error_func: Function to call with the error message in case of an error. Returns: A MonkeyOptions named tuple which contains all options relevant to monkey tests. """ if not options.package: error_func('--package is required.') if options.package not in constants.PACKAGE_INFO: error_func('Invalid package.') category = options.category if category: category = options.category.split(',') return monkey_test_options.MonkeyOptions(options.verbose_count, options.package, options.event_count, category, options.throttle, options.seed, options.extra_args)
def ProcessMonkeyTestOptions(args): """Processes all monkey test options. Args: args: argparse.Namespace object. Returns: A MonkeyOptions named tuple which contains all options relevant to monkey tests. """ # TODO(jbudorick): Handle this directly in argparse with nargs='+' category = args.category if category: category = args.category.split(',') # TODO(jbudorick): Get rid of MonkeyOptions. return monkey_test_options.MonkeyOptions(args.verbose_count, args.package, args.event_count, category, args.throttle, args.seed, args.extra_args)