This repository has been archived by the owner on Sep 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathruntests.py
executable file
·69 lines (60 loc) · 2.08 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env python
import sys
import os
from os.path import dirname, abspath
from optparse import OptionParser
import django
from django.conf import settings
if not settings.configured and not os.environ.get('DJANGO_SETTINGS_MODULE'):
settings.configure(
DATABASES = {
'default': {
"ENGINE": 'django.db.backends.mysql',
"NAME": 'conference',
"USER": 'conferenceUser',
"PASSWORD": 'conferencePass',
}
},
INSTALLED_APPS = [
'dal',
'dal_select2',
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.staticfiles',
'django_conference',
],
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
),
SERIALIZATION_MODULES = {},
STATIC_URL = '/static/',
LOGIN_URL = '/account/',
ROOT_URLCONF = 'django_conference.urls',
DEBUG = True,
SITE_ID = 1,
)
from django.test.utils import setup_test_environment
from django.test.runner import DiscoverRunner
def runtests(options={}):
parent = dirname(abspath(__file__))
sys.path.insert(0, parent)
django.setup()
setup_test_environment()
test_runner = DiscoverRunner(**options)
failures = test_runner.run_tests(['django_conference'])
sys.exit(failures)
if __name__ == '__main__':
parser = OptionParser()
parser.add_option('--verbosity', default=1, dest='verbosity')
parser.add_option('--interactive', action='store_true', default=False,
dest='interactive')
parser.add_option('--failfast', action='store_true', default=False,
dest='failfast')
(options, args) = parser.parse_args()
runtests(vars(options))