<commit_before># -*- coding: utf-8 -*-
# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.


import nose


class TestSuiteLoader(object):

    def create_suite_from_classes(self, test_class_list):
        return self.create_suite_from_list(map(lambda test_class: self.load_tests_from(test_class), test_class_list))

    def create_suite_from_list(self, test_suite_list):
        return nose.suite.LazySuite(test_suite_list)

    def load_tests_from(self, test_case):
        return nose.loader.TestLoader().loadTestsFromTestCase(test_case)


class TestRunner(object):

    def __init__(self, test_mode):
        self.test_mode = test_mode

    def run_test_suite(self, suite):
        test_runner = nose.core.TextTestRunner(verbosity=2)

        if self.test_mode == 'ci':
            import teamcity.unittestpy
            test_runner = teamcity.unittestpy.TeamcityTestRunner()

        return test_runner.run(suite)<commit_msg>[#6699037] Added testing.helpers.execution.TestMode enum class.<commit_after># -*- coding: utf-8 -*-
# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.


import nose


class TestSuiteLoader(object):

    def create_suite_from_classes(self, test_class_list):
        return self.create_suite_from_list(map(lambda test_class: self.load_tests_from(test_class), test_class_list))

    def create_suite_from_list(self, test_suite_list):
        return nose.suite.LazySuite(test_suite_list)

    def load_tests_from(self, test_case):
        return nose.loader.TestLoader().loadTestsFromTestCase(test_case)


class TestMode(object):

    NORMAL = 'normal'
    CONTINUOUS_INTEGRATION = 'ci'


class TestRunner(object):

    def __init__(self, test_mode):
        self.test_mode = test_mode

    def run_test_suite(self, suite):
        test_runner = nose.core.TextTestRunner(verbosity=2)

        if self.test_mode == TestMode.CONTINUOUS_INTEGRATION:
            import teamcity.unittestpy
            test_runner = teamcity.unittestpy.TeamcityTestRunner()

        return test_runner.run(suite)
{'fraction_non_alphanumeric': 0.08779884583676835, 'fraction_numerical': 0.004534212695795548, 'mean_word_length': 3.8059405940594058, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3421537', 'n_tokens_mistral': 763, 'n_tokens_neox': 732, 'n_words': 177}