Logo Search packages:      
Sourcecode: mago version File versions  Download package

def mago::cmd::parser::parse_options (   args  ) 

Parse options passed through the command line

Definition at line 46 of file parser.py.

00046                        :
    """
    Parse options passed through the command line
    """
    default_target = "~/.mago"
    default_log_level = "critical"

    parser = OptionParser(description="Execute automated tests",
                          option_class=Option)

    parser.add_option('-i', '--info',
                      action="store_true",
                      help=("Display information about test cases "
                            "without executing them"))
    
    group = OptionGroup(parser, "Test selection options")
    group.add_option("-a", "--application",
                     dest="applications",
                     metavar="APPLICATION",
                     action="append",
                     type="string",
                     default=[],
                     help=("Application name to test. Option can be repeated "
                           "and defaults to all applications"))
    group.add_option("-n", "--suite_name",
                     dest="suite_names",
                     metavar="NAME",
                     action="append",
                     type="string",
                     default=[],
                     help=("Suite name to test within applications. Option "
                           "can be repeated and default to all suites "
                           "unless suite name or suite file filtering "
                           "has been enabled"))
    group.add_option("-f", "--suite_file",
                     dest="suite_files",
                     metavar="FILE",
                     action="append",
                     type="string",
                     default=[],
                     help=("Suite file to test within applications. Option "
                           "can be repeated and default to all suites "
                           "unless suite name or suite file filtering "
                           "has been enabled"))
    group.add_option("-c", "--case",
                     dest="cases",
                     metavar="CASE",
                     action="append",
                     type="string",
                     default=[],
                     help="Test cases to run (all, if not specified).")
    parser.add_option_group(group)

    group = OptionGroup(parser, "Logging options")
    group.add_option("-l", "--log",
                     metavar="FILE",
                     help="The file to write the log to.")
    group.add_option("--log-level",
                     default=default_log_level,
                     help="One of debug, info, warning, error or critical.")
    group.add_option("-t", "--target",
                     metavar="DIR",
                     type="dirname",
                     default=default_target,
                     help=("Target directory for logs and reports. Defaults "
                           "to: %default"))
    parser.add_option_group(group)

    (options, args) = parser.parse_args(args[1:])

    return options
    return options


Generated by  Doxygen 1.6.0   Back to index