fix test template settings for Django 1.10

fix_request_path_info
Petr Dlouhý 2016-06-29 16:15:56 +02:00
parent c3f32a1468
commit 37322a75f7
1 changed files with 21 additions and 7 deletions

View File

@ -18,6 +18,16 @@ sys.stderr.write('Using Django version {0} from {1}\n'.format(
) )
if not settings.configured: if not settings.configured:
context_processors = [
'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',
'django.core.context_processors.request',
]
settings.configure( settings.configure(
DEBUG=True, DEBUG=True,
TEMPLATE_DEBUG=True, TEMPLATE_DEBUG=True,
@ -34,13 +44,17 @@ if not settings.configured:
TEMPLATE_LOADERS=( TEMPLATE_LOADERS=(
'django.template.loaders.app_directories.Loader', 'django.template.loaders.app_directories.Loader',
), ),
TEMPLATE_CONTEXT_PROCESSORS=( TEMPLATE_CONTEXT_PROCESSORS=context_processors,
# list() is only needed for older versions of django where this is TEMPLATES = [
# a tuple: {
list(default_settings.TEMPLATE_CONTEXT_PROCESSORS) + [ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
'django.core.context_processors.request', 'DIRS': [],
] 'APP_DIRS': True,
), 'OPTIONS': {
'context_processors': context_processors,
},
},
],
TEST_RUNNER = 'django.test.runner.DiscoverRunner' if django.VERSION >= (1, 7) else 'django.test.simple.DjangoTestSuiteRunner', TEST_RUNNER = 'django.test.runner.DiscoverRunner' if django.VERSION >= (1, 7) else 'django.test.simple.DjangoTestSuiteRunner',
INSTALLED_APPS = ( INSTALLED_APPS = (
'django.contrib.auth', 'django.contrib.auth',