コード例 #1
0
ファイル: cli.py プロジェクト: rezialukius/taurus
def main():
    """
    This function is used as entrypoint by setuptools
    """
    usage = "Usage: bzt [options] [configs] [-aliases]"
    dsc = "BlazeMeter Taurus Tool v%s, the configuration-driven test running engine" % bzt.VERSION
    parser = OptionParserWithAliases(usage=usage, description=dsc, prog="bzt")
    parser.add_option('-l',
                      '--log',
                      action='store',
                      default=None,
                      help="Log file location")
    parser.add_option('-o',
                      '--option',
                      action='append',
                      help="Override option in config")
    parser.add_option('-q',
                      '--quiet',
                      action='store_true',
                      help="Only errors and warnings printed to console")
    parser.add_option('-v',
                      '--verbose',
                      action='store_true',
                      help="Prints all logging messages to console")
    parser.add_option('-n',
                      '--no-system-configs',
                      action='store_true',
                      help="Skip system and user config files")

    parsed_options, parsed_configs = parser.parse_args()

    executor = CLI(parsed_options)

    if is_piped(sys.stdin):
        stdin = sys.stdin.read()
        if stdin:
            with NamedTemporaryFile(prefix="stdin_",
                                    suffix=".config",
                                    delete=False) as fhd:
                fhd.write(b(stdin))
                parsed_configs.append(fhd.name)

    try:
        code = executor.perform(parsed_configs)
    except BaseException as exc_top:
        logging.error("%s: %s", type(exc_top).__name__, exc_top)
        logging.debug("Exception: %s", traceback.format_exc())
        code = 1

    exit(code)
コード例 #2
0
ファイル: cli.py プロジェクト: mfpost/taurus
def main():
    """
    This function is used as entrypoint by setuptools
    """
    usage = "Usage: bzt [options] [configs] [-aliases]"
    dsc = "BlazeMeter Taurus Tool v%s, the configuration-driven test running engine" % bzt.VERSION
    parser = OptionParserWithAliases(usage=usage, description=dsc, prog="bzt")
    parser.add_option('-l', '--log', action='store', default="bzt.log",
                      help="Log file location")
    parser.add_option('-o', '--option', action='append',
                      help="Override option in config")
    parser.add_option('-q', '--quiet', action='store_true',
                      help="Only errors and warnings printed to console")
    parser.add_option('-v', '--verbose', action='store_true',
                      help="Prints all logging messages to console")
    parser.add_option('-n', '--no-system-configs', action='store_true',
                      help="Skip system and user config files")

    parsed_options, parsed_configs = parser.parse_args()

    executor = CLI(parsed_options)

    if is_piped(sys.stdin):
        stdin = sys.stdin.read()
        if stdin:
            with NamedTemporaryFile(prefix="stdin_", suffix=".config", delete=False) as fhd:
                fhd.write(b(stdin))
                parsed_configs.append(fhd.name)

    try:
        code = executor.perform(parsed_configs)
    except BaseException as exc_top:
        logging.error("%s: %s", type(exc_top).__name__, exc_top)
        logging.debug("Exception: %s", traceback.format_exc())
        code = 1

    exit(code)