Fix xml writing bug introduced in #16388 (#16713)
#16388 introduced a bug where invalid xml could be produced by
`write_junit_xml`, as special characters were no longer being escaped.
The fix is to revert the removal of `from xml.sax.saxutils import
escape` and `escape("\n".join(messages))` in the `write_junit_xml`
function.
I've added a small test case which checks that the `<`, `>`, `&` are
escaped correctly in the xml.