junitxml: move custom properties to properties element
<testsuite> <testcase> <properties> <property name="ABC" value="XYZ" /> <property name="DEF" value="ZYX" /> </properties> </testcase> </testsuite>
This commit is contained in:
parent
b2b003dcac
commit
02a2272cfe
|
@ -137,7 +137,15 @@ class LogXML(object):
|
||||||
self.tests[-1].append(obj)
|
self.tests[-1].append(obj)
|
||||||
|
|
||||||
def append_custom_properties(self):
|
def append_custom_properties(self):
|
||||||
self.tests[-1].attr.__dict__.update(self.custom_properties)
|
if self.custom_properties:
|
||||||
|
self.tests[-1].append(
|
||||||
|
Junit.properties(
|
||||||
|
[
|
||||||
|
Junit.property(name=name, value=value)
|
||||||
|
for name, value in self.custom_properties.items()
|
||||||
|
]
|
||||||
|
)
|
||||||
|
)
|
||||||
self.custom_properties.clear()
|
self.custom_properties.clear()
|
||||||
|
|
||||||
def append_pass(self, report):
|
def append_pass(self, report):
|
||||||
|
|
|
@ -174,7 +174,11 @@ This will add an extra property ``example_key="1"`` to the generated
|
||||||
|
|
||||||
.. code-block:: xml
|
.. code-block:: xml
|
||||||
|
|
||||||
<testcase classname="test_function" example_key="1" file="test_function.py" line="0" name="test_function" time="0.0009">
|
<testcase classname="test_function" file="test_function.py" line="0" name="test_function" time="0.0009">
|
||||||
|
<properties>
|
||||||
|
<property name="example_key" value="1" />
|
||||||
|
</properties>
|
||||||
|
</testcase>
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
|
|
|
@ -561,5 +561,7 @@ def test_record_property(testdir):
|
||||||
result, dom = runandparse(testdir, '-rw')
|
result, dom = runandparse(testdir, '-rw')
|
||||||
node = dom.getElementsByTagName("testsuite")[0]
|
node = dom.getElementsByTagName("testsuite")[0]
|
||||||
tnode = node.getElementsByTagName("testcase")[0]
|
tnode = node.getElementsByTagName("testcase")[0]
|
||||||
assert_attr(tnode, foo="<1")
|
psnode = tnode.getElementsByTagName('properties')[0]
|
||||||
|
pnode = psnode.getElementsByTagName('property')[0]
|
||||||
|
assert_attr(pnode, name="foo", value="<1")
|
||||||
result.stdout.fnmatch_lines('*C3*test_record_property.py*experimental*')
|
result.stdout.fnmatch_lines('*C3*test_record_property.py*experimental*')
|
||||||
|
|
Loading…
Reference in New Issue