Skip to content

Commit

Permalink
Escape control chars in XML test report creation
Browse files Browse the repository at this point in the history
  • Loading branch information
tmbrbr committed Aug 9, 2023
1 parent 57556fc commit 410b044
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions testing/mozbase/mozlog/mozlog/formatters/xunit.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from xml.etree import ElementTree

import re
import six

from . import base
Expand Down Expand Up @@ -109,6 +110,8 @@ def suite_end(self, data):
}
)
xml_string = ElementTree.tostring(self.root, encoding="utf8")
# Need to remove control characters as they confuse minidom
xml_string = re.sub(r'[\x00-\x1F]+', '', xml_string.decode())
# pretty printing can not be done from xml.etree
from xml.dom import minidom

Expand Down

0 comments on commit 410b044

Please sign in to comment.