Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure FancyReporter detects encoding of the traceback messages. #137

Open
wants to merge 1 commit into
base: 0.5.x
Choose a base branch
from

Conversation

sublee
Copy link

@sublee sublee commented Aug 24, 2012

Hi Dag,

I'm going to use Attest==0.5.3 instead of Unittest for my project focused on Korean language. So my test suites contain many Hangul characters (non-ASCII) and are hinted encoding by # -*- coding: utf-8 -*-. But traceback message of FancyReporter is broken because it doesn't aware the encoding of the test code.

# -*- coding: utf-8 -*-
from attest import Tests, assert_hook

suite = Tests()

@suite.test
def unicode_failing():
    assert u'유니코드' == u'테스트'

The output will be broken:

[100%] 1 of 1 Time: 0:00:00

koreantests.unicode_failing
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "koreantests.py", line 7, in unicode_failing
    assert u'ì ëì½ë' == u'í
ì¤í¸'
TestFailure

assert (u'\uc720\ub2c8\ucf54\ub4dc' == u'\ud14c\uc2a4\ud2b8')
assert (u'\uc720\ub2c8\ucf54\ub4dc' == u'\ud14c\uc2a4\ud2b8')

Failures: 1/1 (1 assertions)

My patch provides the code encoding detector for fix broken messages of FancyReporter:

[100%] 1 of 1 Time: 0:00:00

koreantests.unicode_failing
--------------------------------------------------------------------------------
Traceback (most recent call last):
  File "koreantests.py", line 7, in unicode_failing
    assert u'유니코드' == u'테스트'
TestFailure

assert (u'\uc720\ub2c8\ucf54\ub4dc' == u'\ud14c\uc2a4\ud2b8')
assert (u'\uc720\ub2c8\ucf54\ub4dc' == u'\ud14c\uc2a4\ud2b8')

Failures: 1/1 (1 assertions)

Please review and accept this pull request if there's no problem.

Regards,
Heungsub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant