How to use the stestr.commands.run_command function in stestr

To help you get started, we’ve selected a few stestr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openstack / os-testr / os_testr / ostestr.py View on Github external
'.testr.conf') and not os.path.isfile('.stestr.conf'):
        msg = ('No .stestr.conf found, please create one.')
        print(msg)
        sys.exit(1)

    regexes = None
    if regex:
        regexes = regex.split()
    serial = not parallel
    if list_tests:
        # TODO(mtreinish): remove init call after list command detects and
        # autocreates the repository
        if not os.path.isdir('.stestr'):
            commands.init_command()
        return commands.list_command(filters=regexes)
    return_code = commands.run_command(filters=regexes, subunit_out=subunit,
                                       concurrency=concur, test_path=test_dir,
                                       top_dir=top_dir,
                                       group_regex=group_regex,
                                       until_failure=until_failure,
                                       serial=serial, pretty_out=pretty,
                                       load_list=load_list,
                                       blacklist_file=blacklist_file,
                                       whitelist_file=whitelist_file,
                                       black_regex=black_regex)

    if slowest:
        sys.stdout.write("\nSlowest Tests:\n")
        commands.slowest_command()
    return return_code
github openstack / tempest / tempest / cmd / run.py View on Github external
print("No .stestr.conf file was found for local execution")
            sys.exit(2)
        if parsed_args.state:
            self._init_state()

        regex = self._build_regex(parsed_args)
        return_code = 0
        if parsed_args.list_tests:
            return_code = commands.list_command(
                filters=regex, whitelist_file=parsed_args.whitelist_file,
                blacklist_file=parsed_args.blacklist_file,
                black_regex=parsed_args.black_regex)

        else:
            serial = not parsed_args.parallel
            return_code = commands.run_command(
                filters=regex, subunit_out=parsed_args.subunit,
                serial=serial, concurrency=parsed_args.concurrency,
                blacklist_file=parsed_args.blacklist_file,
                whitelist_file=parsed_args.whitelist_file,
                black_regex=parsed_args.black_regex,
                load_list=parsed_args.load_list, combine=parsed_args.combine)
            if return_code > 0:
                sys.exit(return_code)
        return return_code