# HG changeset patch # User Siddharth Agarwal # Date 2017-06-07 22:47:06 # Node ID a4d0e816a67270839c0102d0e43cc2034e4b3b3d # Parent ef8d245396121f0dd1687ba04a48a1da4ae13124 run-tests: add information about skipped tests to XUnit output The XUnit spec supports skipped tests. diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -2061,6 +2061,17 @@ class TextTestRunner(unittest.TextTestRu failelem.appendChild(cd) t.appendChild(failelem) s.appendChild(t) + for tc, message in result.skipped: + # According to the schema, 'skipped' has no attributes. So store + # the skip message as a text node instead. + t = doc.createElement('testcase') + t.setAttribute('name', tc.name) + message = cdatasafe(message).decode('utf-8', 'replace') + cd = doc.createCDATASection(message) + skipelem = doc.createElement('skipped') + skipelem.appendChild(cd) + t.appendChild(skipelem) + s.appendChild(t) outf.write(doc.toprettyxml(indent=' ', encoding='utf-8')) @staticmethod diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t --- a/tests/test-run-tests.t +++ b/tests/test-run-tests.t @@ -676,6 +676,10 @@ Skips with xml (glob) + + + + Missing skips or blacklisted skips don't count as executed: