Issue31273
Created on 2017-08-24 20:37 by Nathan Buckner, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue.txt | Nathan Buckner, 2017-08-24 20:37 | |||
| Messages (3) | |||
|---|---|---|---|
| msg300802 - (view) | Author: Nathan Buckner (Nathan Buckner) | Date: 2017-08-24 20:37 | |
Unicode support for TestCase.skip is broken because the caught SkipTest exception is passed through a str call.
except SkipTest as e:
self._addSkip(result, str(e))
Could be fixed with by changing to unicode(e)
|
|||
| msg305232 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2017-10-30 15:44 | |
> Could be fixed with by changing to unicode(e) Replacing str(e) with unicode(e) can introduce Unicode errors regressions. I'm not confident in doing such change late in the old 2.7 branch. I suggest you to only use native strings (byte strings, "str" type) in Python 2, and slowly upgrade your application to Python 3. I propose to close this issue as WONT FIX. |
|||
| msg305234 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2017-10-30 15:55 | |
I concur with Victor. Unlikely this affects many people since skipping messages usually are ASCII strings.
As a workaround you can implement your own skip() method that encodes unicode to 8-bit string.
def skip(self, reason):
if isinstance(reason, unicode):
reason = unicode.encode(reason, 'utf-8')
TestCase.skip(self, reason)
|
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:51 | admin | set | github: 75456 |
| 2017-10-30 15:55:20 | serhiy.storchaka | set | status: open -> closed nosy:
+ serhiy.storchaka resolution: wont fix |
| 2017-10-30 15:44:10 | vstinner | set | messages:
+ msg305232 title: Unicode support in TestCase.skip -> [2.7] unittest: Unicode support in TestCase.skip |
| 2017-10-29 02:35:15 | berker.peksag | set | nosy:
+ rbcollins, michael.foord type: crash -> behavior |
| 2017-08-24 20:37:13 | Nathan Buckner | create | |
