<commit_before>from shinken_modules import *
import os
import sys
import re
import subprocess
import shutil
import time
import random
import copy

sys.path.append('../shinken/modules')

from shinken.comment import Comment


class TestConfig(ShinkenModulesTest):
    def contains_line(self, text, pattern):
        regex = re.compile(pattern)
        for line in text.splitlines():
            if re.search(regex, line):
                return True
        return False

    def tearDown(self):
        self.livestatus_broker.db.commit()
        self.livestatus_broker.db.close()
        if os.path.exists(self.livelogs):
            os.remove(self.livelogs)
        if os.path.exists(self.livelogs + "-journal"):
            os.remove(self.livelogs + "-journal")
        if os.path.exists("tmp/archives"):
            for db in os.listdir("tmp/archives"):
                print "cleanup", db
                os.remove(os.path.join("tmp/archives", db))
        if os.path.exists('var/nagios.log'):
            os.remove('var/nagios.log')
        if os.path.exists('var/retention.dat'):
            os.remove('var/retention.dat')
        if os.path.exists('var/status.dat'):
            os.remove('var/status.dat')
        self.livestatus_broker = None


class TestConfigBig(TestConfig):
    def setUp(self):

        start_setUp = time.time()
        self.setup_with_file('etc/shinken_5r_100h_2000s.cfg')
        Comment.id = 1<commit_msg>Enh : Test - Remove dupicated code<commit_after>from shinken_modules import *
import os
import sys
import re
import subprocess
import shutil
import time
import random
import copy

sys.path.append('../shinken/modules')

from shinken.comment import Comment


class TestConfigBig(TestConfig):
    def setUp(self):

        start_setUp = time.time()
        self.setup_with_file('etc/shinken_5r_100h_2000s.cfg')
        Comment.id = 1
{'fraction_non_alphanumeric': 0.11295503211991435, 'fraction_numerical': 0.009635974304068522, 'mean_word_length': 2.622093023255814, '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': '6249207', 'n_tokens_mistral': 606, 'n_tokens_neox': 588, 'n_words': 122}