<commit_before>from distutils.core import Command


class DiscoverTest(Command):
    description = "Discover and run all tests"
    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        import unittest
        import os

        project_dir = os.path.dirname(os.path.realpath(__file__))

        test_loader = unittest.defaultTestLoader
        test_suite = test_loader.discover(project_dir)

        test_runner = unittest.TextTestRunner()
        return 1 if test_runner.run(test_suite).wasSuccessful() else 0<commit_msg>Fixed error-code in test_runner when its fail<commit_after>from distutils.core import Command


class DiscoverTest(Command):
    description = "Discover and run all tests"
    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        import unittest
        import os

        project_dir = os.path.dirname(os.path.realpath(__file__))

        test_loader = unittest.defaultTestLoader
        test_suite = test_loader.discover(project_dir)

        test_runner = unittest.TextTestRunner()
        if not test_runner.run(test_suite).wasSuccessful():
            raise SystemExit(1)
        else:
            return 0
{'fraction_non_alphanumeric': 0.07580398162327719, 'fraction_numerical': 0.0030627871362940277, 'mean_word_length': 2.7130681818181817, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6465818', 'n_tokens_mistral': 379, 'n_tokens_neox': 359, 'n_words': 85}