<commit_before>"""Run tests in a module or directory.

Usage:
    rotest [<path>...] [options]

Options:
    -h,  --help
            Show help message and exit.
    --version
            Print version information and exit.
    -c <path>, --config <path>
            Test configuration file path.
    -s, --save-state
            Enable saving state of resources.
    -d <delta-iterations>, --delta <delta-iterations>
            Enable run of failed tests only - enter the number of times the
            failed tests should be run.
    -p <processes>, --processes <processes>
            Use multiprocess test runner - specify number of worker
            processes to be created.
    -o <outputs>, --outputs <outputs>
            Output handlers separated by comma.
    -f <query>, --filter <query>
            Run only tests that match the filter expression,
            e.g. 'Tag1* and not Tag13'.
    -n <name>, --name <name>
            Assign a name for current launch.
    -l, --list
            Print the tests hierarchy and quit.
    -F, --failfast
            Stop the run on first failure.
    -D, --debug
            Enter ipdb debug mode upon any test exception.
    -S, --skip-init
            Skip initialization and validation of resources.
    -r <query>, --resources <query>
            Specify resources to request by attributes,
            e.g. '-r res1.group=QA,res2.comment=CI'.
"""
# pylint: disable=unused-argument
# pylint: disable=too-many-arguments,too-many-locals,redefined-builtin
from __future__ import print_function
import sys
import inspect
import argparse
from itertools import chain

import django
import pkg_resources
from attrdict import AttrDict

from rotest.core import TestSuite
from rotest.common import core_log
from rotest.core.filter import match_tags
from rotest.core.utils.common import print_test_hierarchy
from rotest.core.result.result import get_result_handlers
from rotest.cli.discover import discover_tests_under_paths
from rotest.core.runner import (DEFAULT_CONFIG_PATH, parse_config_file,
                                update_resource_requests, run as rotest_runner,
                                parse_resource_identifiers)


def parse_outputs_option(outputs):
    """Parse value from CLI and validate all outputs are valid.

    Args:
        outputs (str): value gotten from CLI, e.g. "dots,excel".

    Returns:
        set: set of all parsed output handlers.
    """
    if not outputs:
        return None

    requested_handlers = set(outputs.split(","))

    available_handlers = set(get_result_handlers())

    non_existing_handlers = requested_handlers - available_handlers

    if non_existing_handlers:
        raise ValueError("The following output handlers are not "
                         "existing: {}.\nAvailable options: {}.".format(
                              ", ".join(non_existing_handlers),
                              ", ".join(available_handlers)))

    return requested_handlers
<commit_msg>Casted output handlers to list after usage.<commit_after>"""Run tests in a module or directory.

Usage:
    rotest [<path>...] [options]

Options:
    -h,  --help
            Show help message and exit.
    --version
            Print version information and exit.
    -c <path>, --config <path>
            Test configuration file path.
    -s, --save-state
            Enable saving state of resources.
    -d <delta-iterations>, --delta <delta-iterations>
            Enable run of failed tests only - enter the number of times the
            failed tests should be run.
    -p <processes>, --processes <processes>
            Use multiprocess test runner - specify number of worker
            processes to be created.
    -o <outputs>, --outputs <outputs>
            Output handlers separated by comma.
    -f <query>, --filter <query>
            Run only tests that match the filter expression,
            e.g. 'Tag1* and not Tag13'.
    -n <name>, --name <name>
            Assign a name for current launch.
    -l, --list
            Print the tests hierarchy and quit.
    -F, --failfast
            Stop the run on first failure.
    -D, --debug
            Enter ipdb debug mode upon any test exception.
    -S, --skip-init
            Skip initialization and validation of resources.
    -r <query>, --resources <query>
            Specify resources to request by attributes,
            e.g. '-r res1.group=QA,res2.comment=CI'.
"""
# pylint: disable=unused-argument
# pylint: disable=too-many-arguments,too-many-locals,redefined-builtin
from __future__ import print_function
import sys
import inspect
import argparse
from itertools import chain

import django
import pkg_resources
from attrdict import AttrDict

from rotest.core import TestSuite
from rotest.common import core_log
from rotest.core.filter import match_tags
from rotest.core.utils.common import print_test_hierarchy
from rotest.core.result.result import get_result_handlers
from rotest.cli.discover import discover_tests_under_paths
from rotest.core.runner import (DEFAULT_CONFIG_PATH, parse_config_file,
                                update_resource_requests, run as rotest_runner,
                                parse_resource_identifiers)


def parse_outputs_option(outputs):
    """Parse value from CLI and validate all outputs are valid.

    Args:
        outputs (str): value gotten from CLI, e.g. "dots,excel".

    Returns:
        set: set of all parsed output handlers.
    """
    if not outputs:
        return None

    requested_handlers = set(outputs.split(","))

    available_handlers = set(get_result_handlers())

    non_existing_handlers = requested_handlers - available_handlers

    if non_existing_handlers:
        raise ValueError("The following output handlers are not "
                         "existing: {}.\nAvailable options: {}.".format(
                              ", ".join(non_existing_handlers),
                              ", ".join(available_handlers)))

    return list(requested_handlers)

{'fraction_non_alphanumeric': 0.08280573142285905, 'fraction_numerical': 0.0016661112962345886, 'mean_word_length': 2.2947310647639956, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6478282', 'n_tokens_mistral': 1619, 'n_tokens_neox': 1581, 'n_words': 562}