def console(input_): """Combine files in a tests/ directory into a single results file.""" unparsed = parsers.parse_config(input_)[1] # Adding the parent is necessary to get the help options parser = argparse.ArgumentParser(parents=[parsers.CONFIG]) # Set the -d and -s options as exclusive, since it's silly to call for diff # and then call for only summary excGroup1 = parser.add_mutually_exclusive_group() excGroup1.add_argument( "-d", "--diff", action="store_const", const="diff", dest='mode', help="Only display the differences between multiple " "result files") excGroup1.add_argument("-s", "--summary", action="store_const", const="summary", dest='mode', help="Only display the summary, not the individual " "test results") excGroup1.add_argument("-i", "--incomplete", action="store_const", const="incomplete", dest='mode', help="Only display tests that are incomplete.") excGroup1.add_argument("-p", "--problems", action="store_const", const="problems", dest='mode', help="Only display tests that had problems.") parser.add_argument("-l", "--list", action="store", help="Use test results from a list file") parser.add_argument("results", metavar="<Results Path(s)>", nargs="+", help="Space separated paths to at least one results " "file") args = parser.parse_args(unparsed) # Throw an error if -d/--diff is called, but only one results file is # provided if args.mode == 'diff' and len(args.results) < 2: parser.error('-d/--diff cannot be specified unless two or more ' 'results files are specified') # make list of results if args.list: args.results.extend(core.parse_listfile(args.list)) # Generate the output summary.console(args.results, args.mode or 'all')
def console(input_): """Combine files in a tests/ directory into a single results file.""" unparsed = parsers.parse_config(input_)[1] # Adding the parent is necessary to get the help options parser = argparse.ArgumentParser(parents=[parsers.CONFIG]) # Set the -d and -s options as exclusive, since it's silly to call for diff # and then call for only summary excGroup1 = parser.add_mutually_exclusive_group() excGroup1.add_argument("-d", "--diff", action="store_const", const="diff", dest='mode', help="Only display the differences between multiple " "result files") excGroup1.add_argument("-s", "--summary", action="store_const", const="summary", dest='mode', help="Only display the summary, not the individual " "test results") excGroup1.add_argument("-i", "--incomplete", action="store_const", const="incomplete", dest='mode', help="Only display tests that are incomplete.") excGroup1.add_argument("-p", "--problems", action="store_const", const="problems", dest='mode', help="Only display tests that had problems.") parser.add_argument("-l", "--list", action="store", help="Use test results from a list file") parser.add_argument("results", metavar="<Results Path(s)>", nargs="+", help="Space separated paths to at least one results " "file") args = parser.parse_args(unparsed) # Throw an error if -d/--diff is called, but only one results file is # provided if args.mode == 'diff' and len(args.results) < 2: parser.error('-d/--diff cannot be specified unless two or more ' 'results files are specified') # make list of results if args.list: args.results.extend(core.parse_listfile(args.list)) # Generate the output summary.console(args.results, args.mode or 'all')