fix unicode issues (port of pypy/py repo changeset r72526 by Armin)
--HG-- branch : trunk
This commit is contained in:
		
							parent
							
								
									7084313408
								
							
						
					
					
						commit
						f6a04b92d2
					
				|  | @ -2,10 +2,11 @@ Changes between 1.2.1 and 1.2.2 (release pending) | |||
| ================================================== | ||||
| 
 | ||||
| - new mechanism to allow plugins to register new hooks  | ||||
| - fixes for handling of unicode exception values | ||||
| - added links to the new capturelog and coverage plugins  | ||||
| - (issue87) fix unboundlocal error in assertionold code  | ||||
| - (issue86) improve documentation for looponfailing | ||||
| - fix jython/win32 issues | ||||
| - fixes for making jython/win32 work more properly  | ||||
| - ship distribute_setup.py version 0.6.10  | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -581,7 +581,10 @@ class TerminalRepr: | |||
|     def __str__(self): | ||||
|         tw = py.io.TerminalWriter(stringio=True) | ||||
|         self.toterminal(tw) | ||||
|         return tw.stringio.getvalue().strip() | ||||
|         s = tw.stringio.getvalue().strip() | ||||
|         if sys.version_info[0] < 3: | ||||
|             s = s.encode('utf-8') | ||||
|         return s | ||||
| 
 | ||||
|     def __repr__(self): | ||||
|         return "<%s instance at %0x>" %(self.__class__, id(self)) | ||||
|  |  | |||
|  | @ -192,3 +192,10 @@ def test_builtin_patch_unpatch(monkeypatch): | |||
|     assert cpy_builtin.AssertionError is Sub  | ||||
|     assert cpy_builtin.compile == mycompile  | ||||
| 
 | ||||
| 
 | ||||
| def test_unicode_handling(testdir): | ||||
|     value = py.builtin._totext('\xc4\x85\xc4\x87\n', 'utf-8').encode('utf8') | ||||
|     def f(): | ||||
|         raise Exception(value) | ||||
|     excinfo = py.test.raises(Exception, f) | ||||
|     s = str(excinfo) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue