-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.py
executable file
·51 lines (40 loc) · 1.14 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
48
49
50
51
#!/usr/bin/env python
import os
import sys
import logging
import django
from django.conf import settings
from django.test.utils import get_runner
root = logging.getLogger()
root.setLevel(logging.DEBUG)
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(logging.INFO)
formatter = logging.Formatter('%(message)s')
ch.setFormatter(formatter)
root.addHandler(ch)
logger = logging.getLogger(__name__)
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
def run_settings():
settings.configure(
MIDDLEWARE_CLASSES=[],
ROOT_URLCONF='tests.urls_for_tests',
INSTALLED_APPS=[
'the_comm_app',
'django.contrib.auth',
'django.contrib.contenttypes',
],
SECRET_KEY = "LLAMAS",
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
},
)
if __name__ == "__main__":
run_settings()
django.setup()
TestRunner = get_runner(settings)
test_runner = TestRunner()
failures = test_runner.run_tests(["tests"])
sys.exit(bool(failures))