From: Dylan Baker <baker.dyla...@gmail.com> This changes the junit.py script to always convert bytes into unicode before writing, since we do declare that our xml is encoded in unicode.
Signed-off-by: Dylan Baker <dylanx.c.ba...@intel.com> --- framework/backends/junit.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/framework/backends/junit.py b/framework/backends/junit.py index 062c061..f9eec66 100644 --- a/framework/backends/junit.py +++ b/framework/backends/junit.py @@ -25,12 +25,13 @@ from __future__ import ( ) import os.path import shutil - try: from lxml import etree except ImportError: import xml.etree.cElementTree as etree +import six + from framework import grouptools, results, status, exceptions from framework.core import PIGLIT_CONFIG from .abstract import FileBackend @@ -113,9 +114,10 @@ class JUnitBackend(FileBackend): f.write("<?xml version='1.0' encoding='utf-8'?>\n") # lxml has a pretty print we want to use if etree.__name__ == 'lxml.etree': - f.write(etree.tostring(root, pretty_print=True)) + out = etree.tostring(root, pretty_print=True) else: - f.write(etree.tostring(root)) + out = etree.tostring(root) + f.write(out.decode('utf-8')) shutil.rmtree(os.path.join(self._dest, 'tests')) @@ -220,7 +222,7 @@ class JUnitBackend(FileBackend): else: etree.SubElement(element, 'failure', message='Incomplete run.') - f.write(etree.tostring(element)) + f.write(six.text_type(etree.tostring(element).decode('utf-8'))) def _load(results_file): -- 2.7.0 _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit