django-model-utils/runtests.py

40 lines
862 B
Python
Raw Normal View History

2011-04-16 19:49:33 +00:00
#!/usr/bin/env python
import os, sys
from django.conf import settings
if not settings.configured:
settings_dict = dict(
INSTALLED_APPS=(
'django.contrib.contenttypes',
'model_utils',
'model_utils.tests',
),
2012-02-02 15:30:14 +00:00
DATABASES={
2011-04-16 19:49:33 +00:00
"default": {
"ENGINE": "django.db.backends.sqlite3"
2012-02-02 15:30:14 +00:00
}
},
)
2011-04-16 19:49:33 +00:00
settings.configure(**settings_dict)
def runtests(*test_args):
if not test_args:
test_args = ['tests']
parent = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, parent)
2012-02-02 15:31:52 +00:00
from django.test.simple import DjangoTestSuiteRunner
failures = DjangoTestSuiteRunner(
verbosity=1, interactive=True, failfast=False).run_tests(test_args)
2011-04-16 19:49:33 +00:00
sys.exit(failures)
if __name__ == '__main__':
runtests()