I'm having a hard time trying to do my unit testing in unicode. I'm
using the unicode branch of Django.

Here's a simple tests.py example:

# -*- encoding: utf-8 -*-
u"""
>>> print u'\u00e4'
this output should not match the above test
"""

When I run this with manage.py test, I get the following error:
    File "/home/ambitone/asiakasprojektit/ostinato/hakuproto/python/
django/test/doctest.py", line 2156, in runTest
      raise self.failureException(self.format_failure(new.getvalue()))
  AssertionError: <unprintable AssertionError object>

If I change line 2156 of django/test/doctest.py to
  raise
self.failureException(self.format_failure(new.getvalue()).encode('UTF-8'))
then everything works flawlessly.

>From what I can tell this problem could be deeper than in Django.
Anyway, it would be nice to have a workaround.

By the way, when running a simple doctest outside Django, it suffices
to do
  import sys, codecs
  sys.stdout = codecs.getwriter(sys.stdout.encoding)(sys.stdout)
before running doctest.testmod(), but that trick didn't work when I
tried to do it in a customized run_tests() using the corresponding
TEST_RUNNER setting.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to