예제 #1
0
파일: run.py 프로젝트: rowlandking/yuno
def main(argv=sys.argv):
    options, parser = cli.get_cli_args(argv)

    if options.command is None:
        parser.print_help()
        sys.exit(2)

    command_handlers = {
        cli.RUN_ALL: _run_all,
        cli.RUN_FAILED: _run_failed,
        cli.RUN_FAILING: _run_failing,
        cli.RUN_PASSED: _run_passed,
        cli.RUN_PASSING: _run_passing,
        cli.RUN_GLOB: _run_glob,
        cli.RUN_PHASE: _run_phase,
        cli.RUN_CHECK: _run_check,
        cli.RUN_PHASE_AND_CHECK: _run_phase_and_check,
        cli.RUN_SUITE: _run_suite,
        cli.RUN_FILES: _run_files,
        cli.RUN_PIPE: _run_pipe,
    }

    try:
        harness, test_set = command_handlers[options.command](options)
        _display_results(harness)

        if options.save_as:
            _save_suite(options.save_as, test_set, overwrite=options.overwrite)

    except core.errors.SuiteLoadError as e:
        print e.for_console()
        print "To see what suites are available, use:"
        print "    yuno.py show suites"

    except core.errors.EmptyTestSet as e:
        print e.for_console()

        if options.command == cli.RUN_GLOB:
            print "To run specific tests, use:"
            print "    yuno.py run files path/to/test*.rc"

        commands_using_globs = (cli.RUN_GLOB, cli.RUN_FILES)
        if options.command in commands_using_globs and os.name == "posix":
            print text.SHELL_GLOB_EXPANSION_WARNING
        # TODO: this.
        # if options.command == cli.RUN_SUITE:
        #     print "To see its contents, use:"
        #     print "    yuno.py show suite {}".format(options.suite)

    except core.errors.YunoError as e:
        print e.for_console()

    except KeyboardInterrupt:
        print "Run stopped. Results were not recorded."
예제 #2
0
파일: certify.py 프로젝트: ledinhminh/yuno
def main(argv=sys.argv):
    options, parser = cli.get_cli_args(argv)

    command_handlers = {
        cli.CERTIFY_FILES: _certify_files,
        cli.CERTIFY_PIPE: _certify_pipe
    }

    try:
        command_handlers[options.command](options)
    except errors.YunoError as e:
        print e.for_console()
예제 #3
0
파일: certify.py 프로젝트: jenrzzz/yuno
def main(argv=sys.argv):
    options, parser = cli.get_cli_args(argv)

    command_handlers = {
        cli.CERTIFY_FILES: _certify_files,
        cli.CERTIFY_PIPE: _certify_pipe
    }

    try:
        command_handlers[options.command](options)
    except errors.YunoError as e:
        print e.for_console()
예제 #4
0
파일: run.py 프로젝트: ledinhminh/yuno
def main(argv=sys.argv):
    options, parser = cli.get_cli_args(argv)

    if options.command is None:
        parser.print_help()
        sys.exit(2)

    command_handlers = {
        cli.RUN_ALL: _run_all,
        cli.RUN_FAILED: _run_failed,
        cli.RUN_FAILING: _run_failing,
        cli.RUN_GLOB: _run_glob,
        cli.RUN_PHASE: _run_phase,
        cli.RUN_CHECK: _run_check,
        cli.RUN_PHASE_AND_CHECK: _run_phase_and_check,
        cli.RUN_SUITE: _run_suite,
        cli.RUN_FILES: _run_files,
        cli.RUN_PIPE: _run_pipe
    }

    try:
        harness, test_set = command_handlers[options.command](options)
        _display_results(harness)

        if options.save_as:
            _save_suite(options.save_as, test_set, overwrite=options.overwrite)

    except core.errors.SuiteLoadError as e:
        print e.for_console()
        print "To see what suites are available, use:"
        print "    yuno.py show suites"

    except core.errors.EmptyTestSet as e:
        print e.for_console()

        if options.command == cli.RUN_GLOB:
            print "To run specific tests, use:"
            print "    yuno.py run files path/to/test*.rc"
        # TODO: this.
        # elif options.command == cli.RUN_SUITE:
        #     print "To see its contents, use:"
        #     print "    yuno.py show suite {}".format(options.suite)

    except core.errors.YunoError as e:
        print e.for_console()

    except KeyboardInterrupt:
        print "Run stopped."
예제 #5
0
파일: certify.py 프로젝트: Sudoka/yuno
def main(argv=sys.argv):
    options, parser = cli.get_cli_args(argv)

    if options.command is None:
        parser.print_help()
        sys.exit(2)

    command_handlers = {
        cli.CERTIFY_FILES: _certify_files,
        cli.CERTIFY_PIPE: _certify_pipe
    }

    try:
        command_handlers[options.command](options)
    except errors.YunoError as e:
        print e.for_console()
    except KeyboardInterrupt:
        print "Stopped."
예제 #6
0
def main(argv=sys.argv):
    options, parser = cli.get_cli_args(argv)

    command_handlers = {
        cli.SHOW_FAILED: _show_failed,
        cli.SHOW_FAILING: _show_failing,
        cli.SHOW_PASSED: _show_passed,
        cli.SHOW_PASSING: _show_passing,
        cli.SHOW_SKIPPED: _show_skipped,
        cli.SHOW_WARNED: _show_warned,
        cli.SHOW_SUITES: _show_suites,
        cli.SHOW_LAST: _show_last
    }

    try:
        command_handlers[options.what]()
    except errors.YunoError as e:
        print e.for_console()
예제 #7
0
def main(args_for_testing: str=None):
    """Generates fMRI scan slice timings.
    Usage:
        <python3> slice_timing.py rep_time num_slices
        Outputs to screen.
    <python3> slice_timing.py -h or --help for detailed help.
    """
    cli_args = get_cli_args(args_for_testing)
    slice_timings, slice_order = slice_times(
                rep_time=cli_args.rep_time,
                num_slices=cli_args.num_slices,
                precision=cli_args.precision,
                unit=cli_args.unit,
                output=cli_args.output,
                verbose=cli_args.verbose,
                order=cli_args.order
                )
    output_slices_info(slice_timings=slice_timings,slice_order=slice_order, dest=cli_args.output,
                       rep_time=cli_args.rep_time, num_slices=cli_args.num_slices)
예제 #8
0
파일: prune.py 프로젝트: Sudoka/yuno
def main(argv):
    options, parser = cli.get_cli_args(argv)

    valid_paths = set([test.source.path for test in testing.load_all()])
    listed_passing = testing.Suite.from_file('data/passing.txt')
    listed_failing = testing.Suite.from_file('data/failing.txt')

    valid_passing = _remove_deleted_tests(listed_passing, valid_paths)
    valid_failing = _remove_deleted_tests(listed_failing, valid_paths)

    try:
        print "Removing deleted tests from your history...\n"

        valid_passing[0].save()
        print "Pruned %d bad paths from passing test list." % valid_passing[1]

        valid_failing[0].save()
        print "Pruned %d bad paths from failing test list." % valid_failing[1]

        if options.prune_last or options.prune_all:
            pruned_from_log = _prune_last_run(valid_paths)
            print "\nPruned %d items from the run log." % pruned_from_log

        if options.prune_suites or options.prune_all:
            print "\n",
            for suite, num_removed in _prune_suites(valid_paths):
                print "Pruned %d bad paths from suite %s (%s)." % (
                    num_removed, suite.name, suite.filename
                )

    except errors.YunoError as e:
        print e.for_console()
        _print_interrupt_warning()

    except KeyboardInterrupt:
        _print_interrupt_warning()

    except BaseException:
        _print_interrupt_warning()
        print "\nReason below:" + ('-' * 80)
        raise
예제 #9
0
파일: show.py 프로젝트: rowlandking/yuno
def main(argv=sys.argv):
    options, parser = cli.get_cli_args(argv)

    if options.what is None:
        parser.print_help()
        sys.exit(2)

    command_handlers = {
        cli.SHOW_FAILED: _show_failed,
        cli.SHOW_FAILING: _show_failing,
        cli.SHOW_PASSED: _show_passed,
        cli.SHOW_PASSING: _show_passing,
        cli.SHOW_SKIPPED: _show_skipped,
        cli.SHOW_WARNED: _show_warned,
        cli.SHOW_SUITES: _show_suites,
        cli.SHOW_LAST: _show_last,
    }

    try:
        command_handlers[options.what]()
    except errors.YunoError as e:
        print e.for_console()
    except KeyboardInterrupt:
        print "Stopped."