How to use the stestr.config_file.TestrConf 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 mtreinish / stestr / stestr / commands / run.py View on Github external
else:
        ids = None
    if load_list:
        list_ids = set()
        # Should perhaps be text.. currently does its own decode.
        with open(load_list, 'rb') as list_file:
            list_ids = set(parse_list(list_file.read()))
        if ids is None:
            # Use the supplied list verbatim
            ids = list_ids
        else:
            # We have some already limited set of ids, just reduce to ids
            # that are both failing and listed.
            ids = list_ids.intersection(ids)

    conf = config_file.TestrConf(config)
    if not analyze_isolation:
        cmd = conf.get_run_command(
            ids, regexes=filters, group_regex=group_regex, repo_type=repo_type,
            repo_url=repo_url, serial=serial, worker_path=worker_path,
            concurrency=concurrency, blacklist_file=blacklist_file,
            whitelist_file=whitelist_file, black_regex=black_regex,
            top_dir=top_dir, test_path=test_path, randomize=random,
            dynamic=dynamic)
        if isolated:
            result = 0
            cmd.setUp()
            try:
                ids = cmd.list_tests()
            finally:
                cmd.cleanUp()
            for test_id in ids:
github mtreinish / stestr / stestr / commands / list.py View on Github external
config file option are set this value will be used.
    :param str blacklist_file: Path to a blacklist file, this file contains a
        separate regex exclude on each newline.
    :param str whitelist_file: Path to a whitelist file, this file contains a
        separate regex on each newline.
    :param str black_regex: Test rejection regex. If a test cases name matches
        on re.search() operation, it will be removed from the final test list.
    :param list filters: A list of string regex filters to initially apply on
        the test list. Tests that match any of the regexes will be used.
        (assuming any other filtering specified also uses it)
    :param file stdout: The output file to write all output to. By default
        this is sys.stdout

    """
    ids = None
    conf = config_file.TestrConf(config)
    cmd = conf.get_run_command(
        regexes=filters, repo_type=repo_type,
        repo_url=repo_url, group_regex=group_regex,
        blacklist_file=blacklist_file, whitelist_file=whitelist_file,
        black_regex=black_regex, test_path=test_path, top_dir=top_dir)
    not_filtered = filters is None and blacklist_file is None\
        and whitelist_file is None and black_regex is None
    try:
        cmd.setUp()
        # List tests if the fixture has not already needed to to filter.
        if not_filtered:
            ids = cmd.list_tests()
        else:
            ids = cmd.test_ids
        stream = BytesIO()
        for id in ids:
github mtreinish / stestr / stestr / commands / list.py View on Github external
def run(args):
    _args = args[0]
    ids = None
    filters = None
    print(args[1])
    if args[1]:
        filters = args[1]
    conf = config_file.TestrConf(_args.config)
    cmd = conf.get_run_command(_args, ids, filters)
    try:
        cmd.setUp()
        # List tests if the fixture has not already needed to to filter.
        if filters is None:
            ids = cmd.list_tests()
        else:
            ids = cmd.test_ids
        stream = BytesIO()
        for id in ids:
            stream.write(('%s\n' % id).encode('utf8'))
        stream.seek(0)
        output.output_stream(stream)
        return 0
    finally:
        cmd.cleanUp()