-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
2731.bug Fix ReprFuncArgs with mixed unicode and utf-8 args. #2733
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @fgmacedo!
Could you please also include a regression test similar to what you posted on the issue and a changelog entry?
For the changelog entry, I suggest a file
|
Yes, for sure! Any hint for where to put the regression test? (I'm reading the |
Hi @nicoddemus, I think that we have reached another issue: def test_setup_fixture_error_with_mixed_encoding(self, testdir):
testdir.makepyfile("""
def mixed_encoding(as_unicode, as_utf8):
assert 0
def setup_function(function):
mixed_encoding(u"'São Paulo'", "'S\xc3\xa3o Paulo'")
def test_nada():
pass
""")
result = testdir.runpytest()
result.stdout.fnmatch_lines([
"*ERROR at setup of test_nada*",
"*setup_function(function):*",
"*as_unicode = \"'São Paulo'\", as_utf8 = \"'São Paulo'\"*",
"*mixed_encoding(as_unicode, as_utf8):*",
"*assert 0*",
"*1 error*",
])
assert result.ret != 0 It works fine on Python 3.6, but fails on Python 2.7:
|
Closing this in favor of #2735 |
The class
_pytest._code.code.ReprFuncArgs
crashes withUnicodeDecodeError
when trying to write args with mixedunicode
andutf-8
strings.Fixes #2731.