forked from lincolnloop/django-ttag
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathruntests.py
42 lines (34 loc) · 1.04 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
#!/usr/bin/env python
import sys
from django.conf import settings
if not settings.configured:
settings.configure(
DATABASE_ENGINE='sqlite3',
DATABASES={'default': {'ENGINE': 'django.db.backends.sqlite3'}},
TEMPLATES=[{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
}],
INSTALLED_APPS=[
'ttag',
'ttag.tests.ttag_test_app'
],
)
try:
# Django <= 1.8
from django.test.simple import DjangoTestSuiteRunner
test_runner = DjangoTestSuiteRunner(verbosity=1)
except ImportError:
# Django >= 1.8
import django
django.setup()
from django.test.runner import DiscoverRunner
test_runner = DiscoverRunner(verbosity=1)
import ttag.tests.ttag_test_app.tags # noqa: Import so tags can self register
def runtests(*test_args):
if not test_args:
test_args = ['ttag']
failures = test_runner.run_tests(test_args)
sys.exit(failures)
if __name__ == '__main__':
runtests(*sys.argv[1:])