mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 16:12:51 +11:00
Cleanup test settings.
This commit is contained in:
parent
e3aa7c06bc
commit
117217fd80
1 changed files with 31 additions and 22 deletions
33
runtests.py
33
runtests.py
|
@ -3,30 +3,39 @@ import sys
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
if not settings.configured:
|
SETTINGS = {
|
||||||
settings.configure(
|
'DATABASES': {
|
||||||
DATABASES={
|
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
'NAME': 'dev.db',
|
'NAME': 'dev.db',
|
||||||
}
|
|
||||||
},
|
},
|
||||||
INSTALLED_APPS=[
|
# 'default': {
|
||||||
|
# 'ENGINE': 'django.db.backends.mysql',
|
||||||
|
# 'NAME': 'dpaste',
|
||||||
|
# 'USER': 'root',
|
||||||
|
# 'PASSWORD': '',
|
||||||
|
# }
|
||||||
|
},
|
||||||
|
'INSTALLED_APPS': [
|
||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'mptt',
|
'mptt',
|
||||||
'dpaste',
|
'dpaste',
|
||||||
],
|
],
|
||||||
MIDDLEWARE_CLASSES=(
|
'MIDDLEWARE_CLASSES': (
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
),
|
),
|
||||||
STATIC_ROOT='/tmp/dpaste_test_static/',
|
'STATIC_ROOT': '/tmp/dpaste_test_static/',
|
||||||
STATIC_URL='/static/',
|
'STATIC_URL': '/static/',
|
||||||
ROOT_URLCONF='dpaste.urls',
|
'ROOT_URLCONF': 'dpaste.urls'
|
||||||
)
|
}
|
||||||
|
|
||||||
def runtests(*test_args):
|
def runtests(*test_args):
|
||||||
# New Django 1.7 app registry
|
# Setup settings
|
||||||
|
if not settings.configured:
|
||||||
|
settings.configure(**SETTINGS)
|
||||||
|
|
||||||
|
# New Django 1.7 app registry setup
|
||||||
try:
|
try:
|
||||||
from django import setup
|
from django import setup
|
||||||
setup()
|
setup()
|
||||||
|
@ -40,7 +49,7 @@ def runtests(*test_args):
|
||||||
from django.test.simple import DjangoTestSuiteRunner as TestRunner
|
from django.test.simple import DjangoTestSuiteRunner as TestRunner
|
||||||
|
|
||||||
test_runner = TestRunner(verbosity=1)
|
test_runner = TestRunner(verbosity=1)
|
||||||
failures = test_runner.run_tests(['dpaste', ])
|
failures = test_runner.run_tests(['dpaste'])
|
||||||
if failures:
|
if failures:
|
||||||
sys.exit(failures)
|
sys.exit(failures)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue