(fixes issue85) correctly write non-ascii test output to junitxml files, refine some internal methods for it

--HG--
branch : trunk
This commit is contained in:
holger krekel
2010-04-27 15:15:43 +02:00
parent f6a04b92d2
commit c8d78177b9
7 changed files with 68 additions and 17 deletions

View File

@@ -417,6 +417,12 @@ class ExceptionInfo(object):
loc = ReprFileLocation(entry.path, entry.lineno + 1, self.exconly())
return str(loc)
def __unicode__(self):
entry = self.traceback[-1]
loc = ReprFileLocation(entry.path, entry.lineno + 1, self.exconly())
return unicode(loc)
class FormattedExcinfo(object):
""" presenting information about failing Functions and Generators. """
# for traceback entries
@@ -579,11 +585,15 @@ class FormattedExcinfo(object):
class TerminalRepr:
def __str__(self):
s = self.__unicode__()
if sys.version_info[0] < 3:
s = s.encode('utf-8')
return s
def __unicode__(self):
tw = py.io.TerminalWriter(stringio=True)
self.toterminal(tw)
s = tw.stringio.getvalue().strip()
if sys.version_info[0] < 3:
s = s.encode('utf-8')
return s
def __repr__(self):