Skip to content

Commit 4986899

Browse files
authored
TestResults: Minor fixes
* TestResults: typo fix in docstring * TestResults: rearrange the logic Test result.err is defined before escaping its content and avoid result.out definition double test.
1 parent b88f844 commit 4986899

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/rift/TestResults.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def junit(self, filename):
143143
144144
When result out property is defined, test outputs (out and err) are
145145
reported in <system-out/> and <system-err/> tags. When only result err
146-
property is defined, it is reported in <failure/> tag onyl when test is
146+
property is defined, it is reported in <failure/> tag only when test is
147147
failed.
148148
"""
149149

@@ -159,14 +159,14 @@ def junit(self, filename):
159159
sub.set('time', f"{result.time:.2f}")
160160
if result.value == 'Failure':
161161
failure = ET.SubElement(sub, 'failure')
162-
if result.out is None:
162+
if result.out is None and result.err:
163163
failure.text = str_xml_escape(result.err)
164164
if result.out:
165165
system_out = ET.SubElement(sub, 'system-out')
166166
system_out.text = str_xml_escape(result.out)
167-
if result.err and result.out:
168-
system_err = ET.SubElement(sub, 'system-err')
169-
system_err.text = str_xml_escape(result.err)
167+
if result.err:
168+
system_err = ET.SubElement(sub, 'system-err')
169+
system_err.text = str_xml_escape(result.err)
170170

171171
tree = ET.ElementTree(suite)
172172
tree.write(filename, encoding='UTF-8', xml_declaration=True)

0 commit comments

Comments
 (0)