[1.8.x] Cleaned up template directory handling in template tests.

Backport of 8e129b42ad from master
This commit is contained in:
Preston Timmons 2015-02-23 15:30:05 -06:00 committed by Tim Graham
parent b22d20dd18
commit 450b42eafe
2 changed files with 3 additions and 7 deletions

View File

@ -1,6 +1,5 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import os
import pickle import pickle
import time import time
from datetime import datetime from datetime import datetime
@ -14,9 +13,10 @@ from django.test import (
RequestFactory, SimpleTestCase, ignore_warnings, override_settings, RequestFactory, SimpleTestCase, ignore_warnings, override_settings,
) )
from django.test.utils import require_jinja2 from django.test.utils import require_jinja2
from django.utils._os import upath
from django.utils.deprecation import RemovedInDjango20Warning from django.utils.deprecation import RemovedInDjango20Warning
from .utils import TEMPLATE_DIR
def test_processor(request): def test_processor(request):
return {'processors': 'yes'} return {'processors': 'yes'}
@ -224,7 +224,7 @@ class SimpleTemplateResponseTest(SimpleTestCase):
@override_settings(TEMPLATES=[{ @override_settings(TEMPLATES=[{
'BACKEND': 'django.template.backends.django.DjangoTemplates', 'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(os.path.dirname(upath(__file__)), 'templates')], 'DIRS': [TEMPLATE_DIR],
'OPTIONS': { 'OPTIONS': {
'context_processors': [test_processor_name], 'context_processors': [test_processor_name],
}, },

View File

@ -1,7 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals from __future__ import unicode_literals
import os
import sys import sys
from django.contrib.auth.models import Group from django.contrib.auth.models import Group
@ -10,9 +9,6 @@ from django.template import (
Context, Template, TemplateSyntaxError, engines, loader, Context, Template, TemplateSyntaxError, engines, loader,
) )
from django.test import SimpleTestCase, override_settings from django.test import SimpleTestCase, override_settings
from django.utils._os import upath
TEMPLATES_DIR = os.path.join(os.path.dirname(upath(__file__)), 'templates')
class TemplateTests(SimpleTestCase): class TemplateTests(SimpleTestCase):