summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGeorg Bauer <gb@hugo.westfalen.de>2005-10-14 23:32:35 +0000
committerGeorg Bauer <gb@hugo.westfalen.de>2005-10-14 23:32:35 +0000
commitcde24debb7c91b7ace343f215e0cb8585470fdaa (patch)
treef9989efcedb5d2982f8cf19f25be764637264835 /tests
parent2a2e2fb6aa7f46a7ada2a320c775a315045f8b83 (diff)
parent67e6252a1ecd6587693b2756bf4bf27c0b89c3e6 (diff)
i18n: merged to [873] from trunk
git-svn-id: http://code.djangoproject.com/svn/django/branches/i18n@874 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-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 4ced220df5..190685a42c 100644
--- a/tests/othertests/templates.py
+++ b/tests/othertests/templates.py
@@ -260,15 +260,18 @@ TEMPLATE_TESTS = {
'i18n14': ('{{ bool|yesno:"ja,nein" }}', {'bool': True}, 'ja'),
}
-# 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()
@@ -295,7 +298,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