def setUp(self):

        self.root = os.path.dirname(__import__(settings.ROOT_URLCONF).__file__)
        sys.path.append(self.root)

        # Add the test apps to INSTALLED_APPS.
        self.unique_id = str(uuid4()).replace("-", "")
        self.test_apps = ["app%s%s" % (i, self.unique_id) for i in range(10)]

        # Create the app directories with the test template.
        for test_app in self.test_apps:
            app_dir = os.path.join(self.root, test_app)
            os.mkdir(app_dir)
            app_templates = os.path.join(app_dir, "templates")
            os.mkdir(app_templates)
            with open(os.path.join(app_dir, "__init__.py"), "w") as f:
                f.write("")
            extends = test_app != self.test_apps[-1]
            self._create_template(app_templates, test_app, extends)

        # Add the test template to the project, and store a flag
        # indicating whether or not the project templates directory
        # existed, so if it does, we can leave it in place when we
        # clean everything up.
        project_templates = os.path.join(self.root, "templates")
        self.project_templates_exist = os.path.exists(project_templates)
        if not self.project_templates_exist:
            os.mkdir(project_templates)
        self._create_template(project_templates, "project", True)
Put the test template into a couple of test apps and the project.
dataset/ETHPy150Open stephenmcd/django-overextends/overextends/tests.py/Tests.setUp