예제 #1
0
    def execute(self, args):
        if args.report_args_help:
            report_types[args.report_args_help].get_parser().print_help()
            return
        if args.runner_args_help:
            runner_types[args.runner_args_help].get_parser().print_help()
            return

        venv = VirtuelEnv(
            args.package,
            args.venv,
            args.recreate_venv)
        venv.activate()

        report_type = report_types[args.report_type]
        report = report_type.parse_args(shlex.split(args.report_args))

        resmgr_backend = resmgr_backend_types[args.resmgr_backend_type]()

        runner_type = runner_types[args.runner_type]
        runner = runner_type.parse_args(shlex.split(args.runner_args), report, resmgr_backend)

        planname = args.plan
        planmodulename, planclsname = planname.rsplit(".", 1)
        __import__(planmodulename)
        planmod = sys.modules[planmodulename]
        plancls = getattr(planmod, planclsname)
        runner.run(plancls())
        if not report.is_passed():
            sys.exit(1)
예제 #2
0
    def execute(self, args):
        if args.report_args_help:
            report_types[args.report_args_help].get_parser().print_help()
            return
        if args.runner_args_help:
            runner_types[args.runner_args_help].get_parser().print_help()
            return

        venv = VirtuelEnv(
            args.package,
            args.venv,
            args.recreate_venv)
        venv.activate()

        report_type = report_types[args.report_type]
        report = report_type.parse_args(shlex.split(args.report_args))

        resmgr_backend = resmgr_backend_types[args.resmgr_backend_type]()

        runner_type = runner_types[args.runner_type]
        runner_args = args.runner_args + " "  # incase user input has no space
        runner = runner_type.parse_args(shlex.split(runner_args), report, resmgr_backend)

        test = TestCaseSettings(
                args.tests,
                args.excluded_names,
                args.priorities,
                args.status,
                args.owners,
                args.tags,
                args.excluded_tags)

        runner.run(test)
        if not report.is_passed():
            sys.exit(1)