Fix TestReport.longreprtext when TestReport.longrepr is not a string

Fix #7559
This commit is contained in:
Bruno Oliveira
2020-07-28 21:02:23 -03:00
parent df09a31646
commit d3267bc49d
3 changed files with 31 additions and 2 deletions

View File

@@ -82,9 +82,10 @@ class BaseReport:
longrepr.toterminal(out)
else:
try:
out.line(longrepr)
s = str(longrepr)
except UnicodeEncodeError:
out.line("<unprintable longrepr>")
s = "<unprintable longrepr>"
out.line(s)
def get_sections(self, prefix: str) -> Iterator[Tuple[str, str]]:
for name, content in self.sections: