forked from mozilla/django-browserid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
runtests.py
33 lines (24 loc) · 908 Bytes
/
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
# This file mainly exists to allow python setup.py test to work.
# http://ericholscher.com/blog/2009/jun/29/enable-setuppy-test-your-django-apps/
import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
os.environ['REUSE_DB'] = '0'
test_dir = os.path.join(os.path.dirname(__file__), 'django_browserid/tests')
sys.path.insert(0, test_dir)
import django
from django.test.utils import get_runner
from django.conf import settings
from django.core.management import call_command
def runtests():
if django.VERSION >= (1, 7, 0):
django.setup()
call_command('migrate', interactive=False)
else:
call_command('syncdb', interactive=False)
call_command('flush', interactive=False)
test_runner = get_runner(settings)
failures = test_runner(interactive=False, failfast=False).run_tests([])
sys.exit(failures)
if __name__ == '__main__':
runtests()