<commit_before>import unittest2
import sys
import os
import shutil

from django.core.management import call_command


class BaseTestCase(unittest2.TestCase):

    test_folder = 't'
    test_project = 'testProject'
    envvar = 'FLEXI_WRAPPED_MODULE'

    @classmethod
    def setUpClass(cls):
        # create test folder
        os.mkdir(cls.test_folder)
        # create a sample project
        call_command('startproject', cls.test_project, cls.test_folder)
        # add this location to sys.path for import
        sys.path.insert(0, os.path.join(os.getcwd(), cls.test_folder))

    def setUp(self):
        # change current directory to test folder
        os.chdir(self.test_folder)

    def tearDown(self):
        if self.envvar in os.environ:
            os.environ.pop(self.envvar)
        os.chdir('..')

    @classmethod
    def tearDownClass(cls):
        shutil.rmtree(cls.test_folder)<commit_msg>add special flexi settings files to tests<commit_after>import unittest2
import sys
import os
import shutil

from django.core.management import call_command


class BaseTestCase(unittest2.TestCase):

    test_folder = 't'
    test_project = 'testProject'
    envvar = 'FLEXI_WRAPPED_MODULE'

    secret_key = 'adummysecretkey'

    @classmethod
    def setUpClass(cls):
        # create test folder
        os.mkdir(cls.test_folder)
        # create a sample project
        call_command('startproject', cls.test_project, cls.test_folder)
        # create environment configuration
        env_fd = open(
            os.path.join(cls.test_folder, cls.test_project, 'env.py'),
            'w')
        env_fd.write("FLEXI_RUN_ENV = 't'")
        env_fd.close()
        # create security file
        sec_fd = open(
            os.path.join(cls.test_folder, cls.test_project, 'security.py'),
            'w')
        sec_fd.write("_SECRET_KEY = '%s'" % cls.secret_key)
        sec_fd.close()
        # create local settings file
        locset_fd = open(
            os.path.join(cls.test_folder, cls.test_project, 'settings_t.py'),
            'w')
        locset_fd.write("SECRET_KEY = _SECRET_KEY")
        locset_fd.close()
        # add this location to sys.path for import
        sys.path.insert(0, os.path.join(os.getcwd(), cls.test_folder))

    def setUp(self):
        # change current directory to test folder
        os.chdir(self.test_folder)

    def tearDown(self):
        if self.envvar in os.environ:
            os.environ.pop(self.envvar)
        os.chdir('..')

    @classmethod
    def tearDownClass(cls):
        shutil.rmtree(cls.test_folder)
{'fraction_non_alphanumeric': 0.10205665502522313, 'fraction_numerical': 0.002328288707799767, 'mean_word_length': 2.507482993197279, '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': '565743', 'n_tokens_mistral': 830, 'n_tokens_neox': 822, 'n_words': 175}