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
|
|
|
|
|
2015-08-12 14:22:26 +10:00
|
|
|
SETTINGS = {
|
|
|
|
'DATABASES': {
|
|
|
|
'default': {
|
|
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
|
|
|
'NAME': 'dev.db',
|
2013-11-26 08:44:36 +11:00
|
|
|
},
|
2015-08-12 14:22:26 +10:00
|
|
|
# 'default': {
|
|
|
|
# 'ENGINE': 'django.db.backends.mysql',
|
|
|
|
# 'NAME': 'dpaste',
|
|
|
|
# 'USER': 'root',
|
|
|
|
# 'PASSWORD': '',
|
|
|
|
# }
|
|
|
|
},
|
2016-03-24 00:15:21 +11:00
|
|
|
'TEMPLATES': [
|
|
|
|
{
|
|
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
|
|
'DIRS': [],
|
|
|
|
'APP_DIRS': True,
|
|
|
|
'OPTIONS': {
|
|
|
|
'context_processors': [
|
|
|
|
'django.template.context_processors.debug',
|
|
|
|
'django.template.context_processors.request',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2015-08-12 14:22:26 +10:00
|
|
|
'INSTALLED_APPS': [
|
|
|
|
'django.contrib.sessions',
|
|
|
|
'django.contrib.staticfiles',
|
|
|
|
'dpaste',
|
|
|
|
],
|
|
|
|
'MIDDLEWARE_CLASSES': (
|
|
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
|
|
|
),
|
|
|
|
'STATIC_ROOT': '/tmp/dpaste_test_static/',
|
|
|
|
'STATIC_URL': '/static/',
|
2016-09-05 04:06:07 +10:00
|
|
|
'ROOT_URLCONF': 'dpaste.urls',
|
|
|
|
'LANGUAGE_CODE': 'en',
|
|
|
|
'LANGUAGES': (('en', 'English'),),
|
2015-08-12 14:22:26 +10:00
|
|
|
}
|
2013-11-26 08:44:36 +11:00
|
|
|
|
|
|
|
def runtests(*test_args):
|
2015-08-12 14:22:26 +10:00
|
|
|
# Setup settings
|
|
|
|
if not settings.configured:
|
|
|
|
settings.configure(**SETTINGS)
|
|
|
|
|
|
|
|
# New Django 1.7 app registry setup
|
2014-10-28 21:52:04 +11:00
|
|
|
try:
|
2014-03-14 02:04:31 +11:00
|
|
|
from django import setup
|
2014-10-28 21:52:04 +11:00
|
|
|
setup()
|
|
|
|
except ImportError:
|
|
|
|
pass
|
|
|
|
|
2015-08-12 13:59:22 +10:00
|
|
|
# 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)
|
2015-08-12 14:22:26 +10:00
|
|
|
failures = test_runner.run_tests(['dpaste'])
|
2013-11-26 08:44:36 +11:00
|
|
|
if failures:
|
|
|
|
sys.exit(failures)
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
runtests(*sys.argv[1:])
|