changeset 34269:20f547806a4d

tests: fix run-tests XML reporting on Python 3 cdatasafe wants to work in terms of bytes, but of course we have a unicode. Easy to work around, especially since we know we'll get utf-8 at the end.
author Augie Fackler <augie@google.com>
date Tue, 19 Sep 2017 00:09:37 -0400
parents 278af5427773
children 3db2365d43e4
files tests/run-tests.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Tue Sep 19 00:08:52 2017 -0400
+++ b/tests/run-tests.py	Tue Sep 19 00:09:37 2017 -0400
@@ -2194,7 +2194,8 @@
             # the skip message as a text node instead.
             t = doc.createElement('testcase')
             t.setAttribute('name', tc.name)
-            message = cdatasafe(message).decode('utf-8', 'replace')
+            binmessage = message.encode('utf-8')
+            message = cdatasafe(binmessage).decode('utf-8', 'replace')
             cd = doc.createCDATASection(message)
             skipelem = doc.createElement('skipped')
             skipelem.appendChild(cd)