mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-06-30 14:20:46 +02:00
Fixing style (according to branch 'autocodestyle') + quicktest
This commit is contained in:
47
quicktest.py
47
quicktest.py
@ -38,6 +38,27 @@ class QuickDjangoTest(object):
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': (
|
||||
# Defaults:
|
||||
"django.contrib.auth.context_processors.auth",
|
||||
"django.template.context_processors.debug",
|
||||
"django.template.context_processors.i18n",
|
||||
"django.template.context_processors.media",
|
||||
"django.template.context_processors.static",
|
||||
"django.template.context_processors.tz",
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
# Our extra:
|
||||
"django.template.context_processors.request",
|
||||
),
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.apps = args
|
||||
# Get the version of the test suite
|
||||
@ -61,11 +82,11 @@ class QuickDjangoTest(object):
|
||||
"""
|
||||
Fire up the Django test suite from before version 1.2
|
||||
"""
|
||||
settings.configure(DEBUG = True,
|
||||
DATABASE_ENGINE = 'sqlite3',
|
||||
DATABASE_NAME = os.path.join(self.DIRNAME, 'database.db'),
|
||||
INSTALLED_APPS = self.INSTALLED_APPS + self.apps
|
||||
)
|
||||
settings.configure(DEBUG=True,
|
||||
DATABASE_ENGINE='sqlite3',
|
||||
DATABASE_NAME=os.path.join(self.DIRNAME, 'database.db'),
|
||||
INSTALLED_APPS=self.INSTALLED_APPS + self.apps
|
||||
)
|
||||
from django.test.simple import run_tests
|
||||
failures = run_tests(self.apps, verbosity=1)
|
||||
if failures:
|
||||
@ -77,8 +98,8 @@ class QuickDjangoTest(object):
|
||||
"""
|
||||
|
||||
settings.configure(
|
||||
DEBUG = True,
|
||||
DATABASES = {
|
||||
DEBUG=True,
|
||||
DATABASES={
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.path.join(self.DIRNAME, 'database.db'),
|
||||
@ -88,15 +109,16 @@ class QuickDjangoTest(object):
|
||||
'PORT': '',
|
||||
}
|
||||
},
|
||||
INSTALLED_APPS = self.INSTALLED_APPS + self.apps,
|
||||
MIDDLEWARE_CLASSES = self.MIDDLEWARE_CLASSES,
|
||||
ROOT_URLCONF = 'helpdesk.tests.urls',
|
||||
STATIC_URL = '/static/'
|
||||
INSTALLED_APPS=self.INSTALLED_APPS + self.apps,
|
||||
MIDDLEWARE_CLASSES=self.MIDDLEWARE_CLASSES,
|
||||
ROOT_URLCONF='helpdesk.tests.urls',
|
||||
STATIC_URL='/static/',
|
||||
TEMPLATES=self.TEMPLATES
|
||||
)
|
||||
|
||||
# compatibility with django 1.8 downwards
|
||||
# see: http://stackoverflow.com/questions/3841725/how-to-launch-tests-for-django-reusable-app
|
||||
|
||||
|
||||
try:
|
||||
# Django >= 1.6
|
||||
from django.test.runner import DiscoverRunner
|
||||
@ -129,4 +151,3 @@ if __name__ == '__main__':
|
||||
parser.add_argument('apps', nargs='+', type=str)
|
||||
args = parser.parse_args()
|
||||
QuickDjangoTest(*args.apps)
|
||||
|
||||
|
Reference in New Issue
Block a user