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

pjenvey noreply at buildbot.pypy.org
Thu May 15 00:35:07 CEST 2014


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

Log:	fix potential UnicodeEncodeErrors under pytest.py --resultlog: the
	captured output may come in as unicode (grafted from
	ef6d8454c0a6cd10097c82056727f5cef8b7830e)

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