# HG changeset patch # User Augie Fackler # Date 2017-09-19 04:09:37 # Node ID 20f547806a4dd4157faa978f1ec7006609606ce3 # Parent 278af542777368294c584fa13214fae78d6e8b75 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. diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -2194,7 +2194,8 @@ class TextTestRunner(unittest.TextTestRu # 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)