From 37322a75f781a0177861acc45e8b0366140260d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Dlouh=C3=BD?= Date: Wed, 29 Jun 2016 16:15:56 +0200 Subject: [PATCH] fix test template settings for Django 1.10 --- runtests.py | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/runtests.py b/runtests.py index 26b2665..d8b6d18 100755 --- a/runtests.py +++ b/runtests.py @@ -18,6 +18,16 @@ sys.stderr.write('Using Django version {0} from {1}\n'.format( ) 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( DEBUG=True, TEMPLATE_DEBUG=True, @@ -34,13 +44,17 @@ if not settings.configured: TEMPLATE_LOADERS=( 'django.template.loaders.app_directories.Loader', ), - TEMPLATE_CONTEXT_PROCESSORS=( - # list() is only needed for older versions of django where this is - # a tuple: - list(default_settings.TEMPLATE_CONTEXT_PROCESSORS) + [ - 'django.core.context_processors.request', - ] - ), + TEMPLATE_CONTEXT_PROCESSORS=context_processors, + TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + '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', INSTALLED_APPS = ( 'django.contrib.auth',