<commit_before>class TestRunner(object):
    def __init__(self, verbosity=1, interactive=True, failfast=True, **kwargs):
        self.verbosity = verbosity
        self.interactive = interactive
        self.failfast = failfast

    def run_tests(self, test_labels):
        import pytest
        import sys

        if test_labels is None:
            print ('Not yet implemented: py.test is still not able to '
                   'discover the tests in all the INSTALLED_APPS as Django '
                   'requires.')
            exit(1)

        pytest_args = []
        if self.failfast:
            pytest_args.append('--exitfirst')
        if self.verbosity == 0:
            pytest_args.append('--quiet')
        elif self.verbosity > 1:
            pytest_args.append('--verbose')

        # Remove arguments before (--). This separates Django command options
        # from py.test ones.
        try:
            pytest_args_index = sys.argv.index('--') + 1
            pytest_args.extend(sys.argv[pytest_args_index:])
        except ValueError:
            pass

        sys.exit(pytest.main(pytest_args))


# Keep the old name to be backwards-compatible
def run_tests(test_labels, verbosity=1, interactive=True, extra_tests=[]):
    runner = TestRunner(verbosity, interactive, failfast=False)
    runner.run_tests(test_labels)
<commit_msg>Make run_tests a function to make it fully backwards compatible<commit_after>class TestRunner(object):
    def __init__(self, verbosity=1, interactive=True, failfast=True, **kwargs):
        self.verbosity = verbosity
        self.interactive = interactive
        self.failfast = failfast

    def run_tests(self, test_labels, extra_tests=None):
        import pytest
        import sys

        if test_labels is None:
            print ('Not yet implemented: py.test is still not able to '
                   'discover the tests in all the INSTALLED_APPS as Django '
                   'requires.')
            exit(1)

        if extra_tests:
            print ('Not yet implemented: py.test is still not able to '
                   'run extra_tests as Django requires.')
            exit(1)

        pytest_args = []
        if self.failfast:
            pytest_args.append('--exitfirst')
        if self.verbosity == 0:
            pytest_args.append('--quiet')
        elif self.verbosity > 1:
            pytest_args.append('--verbose')

        # Remove arguments before (--). This separates Django command options
        # from py.test ones.
        try:
            pytest_args_index = sys.argv.index('--') + 1
            pytest_args.extend(sys.argv[pytest_args_index:])
        except ValueError:
            pass

        sys.exit(pytest.main(pytest_args))


# Keep the old name to be backwards-compatible
def run_tests(test_labels, verbosity=1, interactive=True, extra_tests=None):
    runner = TestRunner(verbosity, interactive, failfast=False)
    runner.run_tests(test_labels, extra_tests)

{'fraction_non_alphanumeric': 0.09284267386900742, 'fraction_numerical': 0.004388926401080351, 'mean_word_length': 2.2032432432432434, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2985000', 'n_tokens_mistral': 851, 'n_tokens_neox': 837, 'n_words': 219}