<commit_before>from __future__ import unicode_literals

import logging
from optparse import make_option

from django.conf import settings
try:
    from django.test.runner import DiscoverRunner
except ImportError:
    try:
        from discover_runner import DiscoverRunner
    except ImportError:
        raise ImportError(
            'django-discover-runner must be installed in order to use '
            '`MutantTestSuiteRunner` under Django < 1.6'
        )

from mutant import logger


class MutantTestSuiteRunner(DiscoverRunner):
    option_list = (
        make_option('-l', '--logger-level',
            dest='logger_level',
            help='Set the level of the `mutant` logger.'),
    )

    def __init__(self, logger_level, **kwargs):
        super(MutantTestSuiteRunner, self).__init__(**kwargs)
        if logger_level:
            logger.setLevel(logger_level)
            logger.addHandler(logging.StreamHandler())

    def build_suite(self, test_labels, extra_tests=None, **kwargs):
        if not test_labels:
            test_labels = [
                "%s.tests" % app for app in settings.INSTALLED_APPS
                if app.startswith('mutant') or app in ('south', 'polymodels')
            ]<commit_msg>Avoid running South and polymodels tests.<commit_after>from __future__ import unicode_literals

import logging
from optparse import make_option

from django.conf import settings
try:
    from django.test.runner import DiscoverRunner
except ImportError:
    try:
        from discover_runner import DiscoverRunner
    except ImportError:
        raise ImportError(
            'django-discover-runner must be installed in order to use '
            '`MutantTestSuiteRunner` under Django < 1.6'
        )

from mutant import logger


class MutantTestSuiteRunner(DiscoverRunner):
    option_list = (
        make_option('-l', '--logger-level',
            dest='logger_level',
            help='Set the level of the `mutant` logger.'),
    )

    def __init__(self, logger_level, **kwargs):
        super(MutantTestSuiteRunner, self).__init__(**kwargs)
        if logger_level:
            logger.setLevel(logger_level)
            logger.addHandler(logging.StreamHandler())

    def build_suite(self, test_labels, extra_tests=None, **kwargs):
        if not test_labels:
            test_labels = [
                "%s.tests" % app for app in settings.INSTALLED_APPS
                if app.startswith('mutant')
            ]
{'fraction_non_alphanumeric': 0.08489795918367347, 'fraction_numerical': 0.0016326530612244899, 'mean_word_length': 2.6257396449704142, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '202697', 'n_tokens_mistral': 687, 'n_tokens_neox': 661, 'n_words': 182}