From 3478fb51d6a1b7f27d2a6696c0e4b1f8b79fd9a8 Mon Sep 17 00:00:00 2001 From: Georg Bauer Date: Thu, 17 Nov 2005 15:55:04 +0000 Subject: [PATCH] fixed two failing i18n tests - they only failed when using ./runtests, now they work both ways. And template tests give tracebacks when they fail. git-svn-id: http://code.djangoproject.com/svn/django/trunk@1277 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/othertests/templates.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/othertests/templates.py b/tests/othertests/templates.py index ec6c55fb05..729105d8fc 100644 --- a/tests/othertests/templates.py +++ b/tests/othertests/templates.py @@ -1,6 +1,8 @@ +import traceback + from django.core import template from django.core.template import loader -from django.utils.translation import activate, deactivate +from django.utils.translation import activate, deactivate, install # Helper objects for template tests class SomeClass: @@ -273,8 +275,11 @@ def run_tests(verbosity=0, standalone=False): tests = TEMPLATE_TESTS.items() tests.sort() for name, vals in tests: + install() if 'LANGUAGE_CODE' in vals[1]: activate(vals[1]['LANGUAGE_CODE']) + else: + activate('en-us') try: output = loader.get_template(name).render(template.Context(vals[1])) except Exception, e: @@ -283,6 +288,7 @@ def run_tests(verbosity=0, standalone=False): print "Template test: %s -- Passed" % name else: if verbosity: + traceback.print_exc() print "Template test: %s -- FAILED. Got %s, exception: %s" % (name, e.__class__, e) failed_tests.append(name) continue