Exemplo n.º 1
0
    def process_args(self, namespace):
        """
        Override this method to add extra argument processing logic.

        Can be used for interdependent argument processing.

        Testplan will use the result dictionary
        to initialize the configuration.
        """
        args = dict(**vars(namespace))

        filter_args = filtering.parse_filter_args(parsed_args=args,
                                                  arg_names=("tags",
                                                             "tags_all",
                                                             "patterns"))

        if filter_args:
            args["test_filter"] = filter_args

        # Cmdline supports shuffle ordering only for now
        if "shuffle" in args:
            args["test_sorter"] = ordering.ShuffleSorter(
                seed=args["shuffle_seed"], shuffle_type=args["shuffle"])

        # We can set arguments in @test_plan decorator or by comman line, for
        # arguments in boolean type if in one place it set tp True, then the
        # final result is True
        args["browse"] = args["browse"] or self._default_options["browse"]
        args["verbose"] = args["verbose"] or self._default_options["verbose"]
        args["debug"] = args["debug"] or self._default_options["debug"]

        # Set stdout style and logging level options according to
        # verbose/debug parameters. Debug output should be a superset of
        # verbose output, i.e. running with just "-d" should automatically
        # give you all "-v" output plus extra DEBUG logs.
        if args["verbose"] or args["debug"]:
            args["stdout_style"] = styles.Style(
                styles.StyleEnum.ASSERTION_DETAIL,
                styles.StyleEnum.ASSERTION_DETAIL,
            )
            if args["debug"]:
                args["logger_level"] = logger.DEBUG
            else:
                args["logger_level"] = logger.INFO

        if args["list"] and "info" not in args:
            args["test_lister"] = listing.NameLister()

        return args
Exemplo n.º 2
0
    def process_args(self, namespace: argparse.Namespace) -> Dict:
        """
        Overrides this method to add extra argument processing logic.

        Can be used for interdependent argument processing.

        Testplan uses the result dictionary to initialize the configuration.

        :param namespace: namespace of parsed arguments
        :return: initial configuration
        """
        args = dict(**vars(namespace))

        filter_args = filtering.parse_filter_args(parsed_args=args,
                                                  arg_names=("tags",
                                                             "tags_all",
                                                             "patterns"))

        if filter_args:
            args["test_filter"] = filter_args

        # Cmdline supports shuffle ordering only for now
        if args.get("shuffle"):
            args["test_sorter"] = ordering.ShuffleSorter(
                seed=args["shuffle_seed"], shuffle_type=args["shuffle"])

        # Set stdout style and logging level options according to
        # verbose/debug parameters. Debug output should be a superset of
        # verbose output, i.e. running with just "-d" should automatically
        # give you all "-v" output plus extra DEBUG logs.
        if args["verbose"] or args["debug"]:
            args["stdout_style"] = styles.Style(
                styles.StyleEnum.ASSERTION_DETAIL,
                styles.StyleEnum.ASSERTION_DETAIL,
            )
            if args["debug"]:
                args["logger_level"] = logger.DEBUG
            elif args["verbose"]:
                args["logger_level"] = logger.INFO

        if args["list"] and not args["test_lister"]:
            args["test_lister"] = listing.NameLister()

        return args
Exemplo n.º 3
0
    def process_args(self, namespace):
        """
        Override this method to add extra argument processing logic.

        Can be used for interdependent argument processing.

        Testplan will use the result dictionary
        to initialize the configuration.
        """
        args = dict(**vars(namespace))

        filter_args = filtering.parse_filter_args(parsed_args=args,
                                                  arg_names=('tags',
                                                             'tags_all',
                                                             'patterns'))

        if filter_args:
            args['test_filter'] = filter_args

        # Cmdline supports shuffle ordering only for now
        if 'shuffle' in args:
            args['test_sorter'] = ordering.ShuffleSorter(
                seed=args['shuffle_seed'], shuffle_type=args['shuffle'])

        # Set stdout style and logging level options according to
        # verbose/debug parameters. Debug output should be a superset of
        # verbose output, i.e. running with just "-d" should automatically
        # give you all "-v" output plus extra DEBUG logs.
        if args['verbose'] or args['debug']:
            args['stdout_style'] = styles.Style(
                styles.StyleEnum.ASSERTION_DETAIL,
                styles.StyleEnum.ASSERTION_DETAIL)
            if args['debug']:
                args['logger_level'] = logger.DEBUG
            else:
                args['logger_level'] = logger.INFO

        if args['list'] and 'info' not in args:
            args['test_lister'] = listing.NameLister()

        return args
Exemplo n.º 4
0
    def process_args(self, namespace):
        """
        Override this method to add extra argument processing logic.

        Can be used for interdependent argument processing.

        Testplan will use the result dictionary
        to initialize the configuration.
        """
        args = dict(**vars(namespace))

        filter_args = filtering.parse_filter_args(parsed_args=args,
                                                  arg_names=('tags',
                                                             'tags_all',
                                                             'patterns'))

        if filter_args:
            args['test_filter'] = filter_args

        # Cmdline supports shuffle ordering only for now
        if 'shuffle' in args:
            args['test_sorter'] = ordering.ShuffleSorter(
                seed=args['shuffle_seed'], shuffle_type=args['shuffle'])

        if args['verbose'] is True:
            args['logger_level'] = testplan.logger.INFO
            testplan.logger.TESTPLAN_LOGGER.setLevel(testplan.logger.INFO)
            args['stdout_style'] = styles.Style(
                styles.StyleEnum.ASSERTION_DETAIL,
                styles.StyleEnum.ASSERTION_DETAIL)
        if args['debug'] is True:
            args['logger_level'] = testplan.logger.DEBUG
            testplan.logger.TESTPLAN_LOGGER.setLevel(testplan.logger.DEBUG)

        if args['list'] and 'info' not in args:
            args['test_lister'] = listing.NameLister()

        return args