Esempio n. 1
0
def main():
    """Launcher for command line invokation of rose stem."""

    # Process options
    opt_parser = RoseOptionParser()

    option_keys = SuiteRunner.OPTIONS + OPTIONS
    opt_parser.add_my_options(*option_keys)
    opts, args = opt_parser.parse_args()

    # Set up a runner instance and process the options
    stem = StemRunner(opts)
    if opts.debug_mode:
        opts = stem.process()
    else:
        try:
            opts = stem.process()
        except Exception as e:
            stem.reporter(e)
            sys.exit(1)

    # Get the suiterunner object and execute
    runner = SuiteRunner(event_handler=stem.reporter,
                         popen=stem.popen,
                         fs_util=stem.fs_util)
    if opts.debug_mode:
        sys.exit(runner(opts, args))
    try:
        sys.exit(runner(opts, args))
    except Exception as e:
        runner.handle_event(e)
        if isinstance(e, RosePopenError):
            sys.exit(e.rc)
        else:
            sys.exit(1)
Esempio n. 2
0
def main():
    """Launcher for command line invokation of rose stem."""

    # Process options
    opt_parser = RoseOptionParser()

    option_keys = SuiteRunner.OPTIONS + OPTIONS
    opt_parser.add_my_options(*option_keys)
    opts, args = opt_parser.parse_args()

    # Set up a runner instance and process the options
    stem = StemRunner(opts)
    if opts.debug_mode:
        opts = stem.process()
    else:
        try:
            opts = stem.process()
        except Exception as e:
            stem.reporter(e)
            sys.exit(1)

    # Get the suiterunner object and execute
    runner = SuiteRunner(event_handler=stem.reporter,
                         popen=stem.popen,
                         fs_util=stem.fs_util)
    if opts.debug_mode:
        sys.exit(runner(opts, args))
    try:
        sys.exit(runner(opts, args))
    except Exception as e:
        runner.handle_event(e)
        if isinstance(e, RosePopenError):
            sys.exit(e.rc)
        else:
            sys.exit(1)
Esempio n. 3
0
File: run.py Progetto: kinow/rose
def run_suite(*args):
    """Run "rose suite-run [args]" with a GTK dialog."""

    # Set up reporter
    queue = multiprocessing.Manager().Queue()
    verbosity = Reporter.VV
    out_ctx = ReporterContextQueue(Reporter.KIND_OUT, verbosity, queue=queue)
    err_ctx = ReporterContextQueue(Reporter.KIND_ERR, verbosity, queue=queue)
    event_handler = Reporter(contexts={
        "stdout": out_ctx,
        "stderr": err_ctx
    },
                             raise_on_exc=True)

    # Parse arguments
    suite_runner = SuiteRunner(event_handler=event_handler)
    prog = "rose suite-run"
    description = prog
    if args:
        description += " " + suite_runner.popen.list_to_shell_str(args)
    opt_parse = RoseOptionParser(prog=prog)
    opt_parse.add_my_options(*suite_runner.OPTIONS)
    opts, args = opt_parse.parse_args(list(args))

    # Invoke the command with a GTK dialog
    dialog_process = DialogProcess([suite_runner, opts, args],
                                   description=description,
                                   modal=False,
                                   event_queue=queue)
    return dialog_process.run()