def require_jinja2(test_func):
 test_func = skipIf((jinja2 is None), 'this test requires jinja2')(test_func)
 test_func = override_settings(TEMPLATES=[{'BACKEND': 'django.template.backends.django.DjangoTemplates', 'APP_DIRS': True}, {'BACKEND': 'django.template.backends.jinja2.Jinja2', 'APP_DIRS': True, 'OPTIONS': {'keep_trailing_newline': True}}])(test_func)
 return test_func

def require_jinja2 ( test_func ) : test_func = skipIf ( ( jinja2 is None ) , 'this test requires jinja2' ) ( test_func ) test_func = override_settings ( TEMPLATES = [ { 'BACKEND' : 'django.template.backends.django.DjangoTemplates' , 'APP_DIRS' : True } , { 'BACKEND' : 'django.template.backends.jinja2.Jinja2' , 'APP_DIRS' : True , 'OPTIONS' : { 'keep_trailing_newline' : True } } ] ) ( test_func ) return test_func
decorator to enable a jinja2 template engine in addition to the regular django template engine for a test or skip it if jinja2 isnt available .