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
This commit is contained in:
parent
3bbc2bd091
commit
3478fb51d6
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue