xunit plugin: fix DOM usage
On Python 3, it's not possible to create Elements detached from a
Document. The following code fails (later than it should) on Python
3:
>>> from xml.dom.minidom import Element
>>> e = Element('foo')
>>> e.setAttribute('bar', 'baz')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python3.6/xml/dom/minidom.py", line 741, in setAttribute
attr.ownerDocument = self.ownerDocument
AttributeError: ownerDocument
Let's create elements within the document, with the `createElement`
API. According to the docs "The element is not inserted into the
document when it is created", so the (unchanged) code that actually puts
the element in the right place still applies.
Signed-off-by: NCleber Rosa <crosa@redhat.com>
Showing
想要评论请 注册 或 登录