-
Notifications
You must be signed in to change notification settings - Fork 13
/
runtests.py
54 lines (44 loc) · 1.24 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
# python setup.py test
# or
# python runtests.py
import sys
from django import setup
from django.conf import settings
from django.test.runner import DiscoverRunner as TestRunner
APP = 'django_mailjet'
settings.configure(
DEBUG=True,
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
},
ROOT_URLCONF=APP+'.urls',
INSTALLED_APPS=(
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin',
APP,
),
MIDDLEWARE_CLASSES=(
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
),
TEMPLATES=[
# Djrill doesn't have any templates, but tests need a TEMPLATES
# setting to avoid warnings from the Django 1.8+ test client.
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
},
],
)
setup()
def runtests():
test_runner = TestRunner(verbosity=1)
failures = test_runner.run_tests([APP])
sys.exit(failures)
if __name__ == '__main__':
runtests()