forked from fivethreeo/django-taggit-classy
-
Notifications
You must be signed in to change notification settings - Fork 13
/
runtests.py
executable file
·33 lines (25 loc) · 891 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
#!/usr/bin/env python
import os
from os.path import abspath, join, realpath, dirname
import sys
import django
from django.conf import settings
__dir__ = realpath(dirname(__file__))
sys.path.insert(0, realpath(__dir__))
sys.path.insert(0, realpath(join(__dir__, 'testing')))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project.settings")
def runtests():
if hasattr(django, 'setup'):
django.setup()
try:
from django.test.runner import DiscoverRunner
runner_class = DiscoverRunner
test_args = ['test_project.testapp']
except ImportError:
from django.test.simple import DjangoTestSuiteRunner
runner_class = DjangoTestSuiteRunner
test_args = ['test_project.testapp']
failures = runner_class(failfast=False).run_tests(test_args)
sys.exit(failures)
if __name__ == "__main__":
runtests(*sys.argv[1:])