dpaste/runtests.py

49 lines
1.2 KiB
Python
Raw Normal View History

2013-11-26 08:44:36 +11:00
#!/usr/bin/env python
import sys
2014-12-15 04:03:35 +11:00
2013-11-26 08:44:36 +11:00
from django.conf import settings
if not settings.configured:
settings.configure(
DATABASES={
2013-11-26 08:44:36 +11:00
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'dev.db',
}
},
INSTALLED_APPS=[
'django.contrib.sessions',
'django.contrib.staticfiles',
'mptt',
'dpaste',
],
MIDDLEWARE_CLASSES=(
'django.contrib.sessions.middleware.SessionMiddleware',
),
2013-11-26 08:44:36 +11:00
STATIC_ROOT='/tmp/dpaste_test_static/',
STATIC_URL='/static/',
ROOT_URLCONF='dpaste.urls',
)
def runtests(*test_args):
# New Django 1.7 app registry
try:
from django import setup
setup()
except ImportError:
pass
# New Django 1.8 test runner
try:
from django.test.runner import DiscoverRunner as TestRunner
except ImportError:
from django.test.simple import DjangoTestSuiteRunner as TestRunner
test_runner = TestRunner(verbosity=1)
2013-11-26 08:44:36 +11:00
failures = test_runner.run_tests(['dpaste', ])
if failures:
sys.exit(failures)
if __name__ == '__main__':
runtests(*sys.argv[1:])