forked from stephenmcd/mezzanine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.py
47 lines (39 loc) · 1.36 KB
/
runtests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from __future__ import unicode_literals
def runtests():
import os, sys, shutil, atexit
from mezzanine.utils.importing import path_for_import
os.environ["DJANGO_SETTINGS_MODULE"] = "project_template.settings"
mezz_path = path_for_import("mezzanine")
project_path = os.path.join(mezz_path, "project_template")
local_settings_path = os.path.join(project_path, "local_settings.py")
sys.path.insert(0, mezz_path)
sys.path.insert(0, project_path)
if not os.path.exists(local_settings_path):
shutil.copy(local_settings_path + ".template", local_settings_path)
with open(local_settings_path, "a") as f:
f.write("""
INSTALLED_APPS = (
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.redirects",
"django.contrib.sessions",
"django.contrib.sites",
"django.contrib.sitemaps",
"django.contrib.staticfiles",
"mezzanine.boot",
"mezzanine.conf",
"mezzanine.core",
"mezzanine.generic",
"mezzanine.blog",
"mezzanine.forms",
"mezzanine.pages",
"mezzanine.galleries",
"mezzanine.twitter",
"mezzanine.accounts",
"mezzanine.mobile",
)
""")
atexit.register(lambda: os.remove(local_settings_path))
from django.core.management.commands import test
sys.exit(test.Command().execute(verbosity=1))