mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 16:12:51 +11:00
67 lines
1.7 KiB
Python
Executable file
67 lines
1.7 KiB
Python
Executable file
#!/usr/bin/env python
|
|
import sys
|
|
|
|
import django
|
|
from django.conf import settings
|
|
from django.test.runner import DiscoverRunner as TestRunner
|
|
|
|
|
|
SETTINGS = {
|
|
'DATABASES': {
|
|
'default': {
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
|
'NAME': 'dev.db',
|
|
},
|
|
# 'default': {
|
|
# 'ENGINE': 'django.db.backends.mysql',
|
|
# 'NAME': 'dpaste',
|
|
# 'USER': 'root',
|
|
# 'PASSWORD': '',
|
|
# }
|
|
},
|
|
'TEMPLATES': [
|
|
{
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
'DIRS': [],
|
|
'APP_DIRS': True,
|
|
'OPTIONS': {
|
|
'context_processors': [
|
|
'django.template.context_processors.debug',
|
|
'django.template.context_processors.request',
|
|
'django.template.context_processors.i18n',
|
|
'dpaste.context_processors.dpaste_globals',
|
|
],
|
|
},
|
|
},
|
|
],
|
|
'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/',
|
|
'ROOT_URLCONF': 'dpaste.urls',
|
|
'LANGUAGE_CODE': 'en',
|
|
'LANGUAGES': (('en', 'English'),),
|
|
}
|
|
|
|
def runtests(*test_args):
|
|
# Setup settings
|
|
if not settings.configured:
|
|
settings.configure(**SETTINGS)
|
|
|
|
# app registry setup
|
|
django.setup()
|
|
|
|
# test runner
|
|
test_runner = TestRunner(verbosity=1)
|
|
failures = test_runner.run_tests(['dpaste'])
|
|
if failures:
|
|
sys.exit(failures)
|
|
|
|
if __name__ == '__main__':
|
|
runtests(*sys.argv[1:])
|