From f3740add630fe54ca887d514cb11b990e3d8df87 Mon Sep 17 00:00:00 2001 From: Eric Berquist Date: Mon, 18 Nov 2024 11:40:37 -0700 Subject: [PATCH] test_engine_junit.py: don't mix different types in a single variable --- src/sst/core/testingframework/test_engine_junit.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/sst/core/testingframework/test_engine_junit.py b/src/sst/core/testingframework/test_engine_junit.py index a74ea426d..5d2e311fb 100644 --- a/src/sst/core/testingframework/test_engine_junit.py +++ b/src/sst/core/testingframework/test_engine_junit.py @@ -441,11 +441,12 @@ def junit_to_xml_report_string( if prettyprint: # minidom.parseString() works just on correctly encoded binary strings xml_string = xml_string.encode(encoding or "utf-8") - xml_string = xml.dom.minidom.parseString(xml_string) + xml_string_document = xml.dom.minidom.parseString(xml_string) # toprettyxml() produces unicode if no encoding is being passed # or binary string with an encoding - xml_string = xml_string.toprettyxml(encoding=encoding) - if encoding: + xml_string = xml_string_document.toprettyxml(encoding=encoding) + if isinstance(xml_string, bytes): + assert encoding is not None xml_string = xml_string.decode(encoding) # is unicode now return xml_string