summaryrefslogtreecommitdiff
path: root/coverage/xmlreport.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2019-03-23 21:06:09 -0400
committerNed Batchelder <ned@nedbatchelder.com>2019-03-23 21:06:09 -0400
commita868dd01713cb3020bd768830fca7d1c0eef1720 (patch)
treeb2a0d2dd3af6e5d3bc62b196d2a8b59514b5af4d /coverage/xmlreport.py
parent7e6716562f3b7818c19e06f5cd9c063c02cb7980 (diff)
downloadpython-coveragepy-git-a868dd01713cb3020bd768830fca7d1c0eef1720.tar.gz
Rewrite XML tests to use xml parsing instead of regexes
Diffstat (limited to 'coverage/xmlreport.py')
-rw-r--r--coverage/xmlreport.py13
1 files changed, 0 insertions, 13 deletions
diff --git a/coverage/xmlreport.py b/coverage/xmlreport.py
index 6c07337a..8ecdc24a 100644
--- a/coverage/xmlreport.py
+++ b/coverage/xmlreport.py
@@ -6,7 +6,6 @@
import os
import os.path
-import re
import sys
import time
import xml.dom.minidom
@@ -225,16 +224,4 @@ def serialize_xml(dom):
out = dom.toprettyxml()
if env.PY2:
out = out.encode("utf8")
- # In Python 3.8, minidom lost the sorting of attributes: https://bugs.python.org/issue34160
- # For the limited kinds of XML we produce, this re-sorts them.
- if env.PYVERSION >= (3, 8):
- rx_attr = r' [\w-]+="[^"]*"'
- rx_attrs = r'(' + rx_attr + ')+'
- fixed_lines = []
- for line in out.splitlines(True):
- hollow_line = re.sub(rx_attrs, u"☺", line)
- attrs = sorted(re.findall(rx_attr, line))
- new_line = hollow_line.replace(u"☺", "".join(attrs))
- fixed_lines.append(new_line)
- out = "".join(fixed_lines)
return out