summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2005-10-14 22:28:38 +0000
committerAdrian Holovaty <adrian@holovaty.com>2005-10-14 22:28:38 +0000
commit6ee014725e18bd28af019fc5d8aca0a4e9a47935 (patch)
treede3ef522d1a00ee114a80ce0d5ed23f4a0e72b3d
parent7aefff78335c45edb8dd66aeebadad934fd062ca (diff)
Changed template unit test runner to use new template-loader framework from [870]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@871 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--tests/othertests/templates.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/othertests/templates.py b/tests/othertests/templates.py
index f2da069ea2..d451612713 100644
--- a/tests/othertests/templates.py
+++ b/tests/othertests/templates.py
@@ -217,15 +217,18 @@ TEMPLATE_TESTS = {
'exception04': ("{% extends 'inheritance17' %}{% block first %}{% echo 400 %}5678{% endblock %}", {}, template.TemplateSyntaxError),
}
-# This replaces the standard template loader.
def test_template_loader(template_name, template_dirs=None):
+ "A custom template loader that loads the unit-test templates."
try:
return TEMPLATE_TESTS[template_name][0]
except KeyError:
raise template.TemplateDoesNotExist, template_name
def run_tests(verbosity=0, standalone=False):
- loader.load_template_source, old_template_loader = test_template_loader, loader.load_template_source
+ # Register our custom template loader.
+ old_template_loaders = loader.template_source_loaders
+ loader.template_source_loaders = [test_template_loader]
+
failed_tests = []
tests = TEMPLATE_TESTS.items()
tests.sort()
@@ -248,7 +251,7 @@ def run_tests(verbosity=0, standalone=False):
if verbosity:
print "Template test: %s -- FAILED. Expected %r, got %r" % (name, vals[2], output)
failed_tests.append(name)
- loader.load_template_source = old_template_loader
+ loader.template_source_loaders = old_template_loaders
if failed_tests and not standalone:
msg = "Template tests %s failed." % failed_tests