1
0
Fork 1
mirror of https://github.com/coddingtonbear/django-mailbox.git synced 2026-07-09 22:38:19 +02:00
django-mailbox/django_mailbox/runtests.py

54 lines
1.2 KiB
Python
Raw Normal View History

2013-01-19 00:26:58 -08:00
#!/usr/bin/env python
import sys
from os.path import dirname, abspath
try:
from django import setup
except ImportError:
pass
2013-01-19 00:26:58 -08:00
from django.conf import settings
if not settings.configured:
settings.configure(
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
},
},
INSTALLED_APPS=[
'django.contrib.auth',
'django.contrib.contenttypes',
'django_mailbox',
]
)
try:
from django.test.runner import DiscoverRunner as TestRunner
except ImportError:
from django.test.simple import DjangoTestSuiteRunner as TestRunner
2013-01-19 00:26:58 -08:00
def runtests(*test_args):
if not test_args:
test_args = ['django_mailbox']
parent = dirname(abspath(__file__))
sys.path.insert(0, parent)
try:
# ensure that AppRegistry has loaded
setup()
except NameError:
# This version of Django is too old for an app registry.
pass
runner = TestRunner(
2013-07-25 23:45:39 -07:00
verbosity=1,
interactive=False,
failfast=False
)
2013-01-19 00:26:58 -08:00
failures = runner.run_tests(test_args)
sys.exit(failures)
if __name__ == '__main__':
runtests(*sys.argv[1:])