[pypy-commit] pypy default: fix potential UnicodeEncodeErrors under pytest.py --resultlog: the captured

pjenvey noreply at buildbot.pypy.org
Wed May 14 21:11:20 CEST 2014


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: 
Changeset: r71514:ef6d8454c0a6
Date: 2014-05-14 12:10 -0700
http://bitbucket.org/pypy/pypy/changeset/ef6d8454c0a6/

Log:	fix potential UnicodeEncodeErrors under pytest.py --resultlog: the
	captured output may come in as unicode

diff --git a/_pytest/resultlog.py b/_pytest/resultlog.py
--- a/_pytest/resultlog.py
+++ b/_pytest/resultlog.py
@@ -56,6 +56,9 @@
         for line in longrepr.splitlines():
             py.builtin.print_(" %s" % line, file=self.logfile)
         for key, text in sections:
+            # py.io.StdCaptureFD may send in unicode
+            if isinstance(text, unicode):
+                text = text.encode('utf-8')
             py.builtin.print_(" ", file=self.logfile)
             py.builtin.print_(" -------------------- %s --------------------"
                               % key.rstrip(), file=self.logfile)


More information about the pypy-commit mailing list