Contexts icon indicating copy to clipboard operation
Contexts copied to clipboard

--xml option sometimes outputs control characters that jenkins can't read?

Open hjwp opened this issue 7 years ago • 1 comments

trying to repro outside of jenkins, and maybe --no-colour will fix this, but here's the error:

Stacktrace
Failed to read test report file /home/ansible/workspace/blablabla/test-results/acceptance-tests.xml
org.dom4j.DocumentException: Error on line 1 of document : An invalid XML character (Unicode: 0x1b) was found in the value of attribute "message" and element is "failure". Nested exception: An invalid XML character (Unicode: 0x1b) was found in the value of attribute "message" and element is "failure".
at org.dom4j.io.SAXReader.read(SAXReader.java:482)

and the xml produced by contexts contained what look like ANSI escape characters for colour:

<failure message="^[[0;34mexpected^[[m                                ^[[0;34mgot^[[m                                    &#10;^[[0;31m2^[[m                                       ^[[0;32m1^[[m                                      &#10;" type="failure">
Traceback (most recent call last):  File "/usr/lib/python3.6/site-packages/contexts/core.py", line 293, in run_assertion    yield  File "/usr/lib/python3.6/site-packages/contexts/core.py", line 229, in run    run_with_test_data(self.func, test_data)  File "/usr/lib/python3.6/site-packages/contexts/core.py", line 240, in run_with_test_data    func()  File "/opt/hacienda/hacienda/acceptance/test_stock_received_for_purchase_order.py", line 171, in it_should_have_raised_only_two_goods_in_events    expect(len(events)).to(equal(2))  File "/usr/lib/python3.6/site-packages/expects/expectations.py", line 19, in to    self._assert(matcher)  File "/usr/lib/python3.6/site-packages/expects/expectations.py", line 25, in _assert    raise AssertionError(self._failure_message(matcher, reasons))AssertionError: ^[[0;34mexpected^[[m                                ^[[0;34mgot^[[m                                    ^[[0;31m2^[[m                                       ^[[0;32m1^[[m</failure>
</testcase>

i think even if the user is running without --no-colour, the junit xml should probably never have ansi control chars in...

hjwp avatar Jun 21 '18 16:06 hjwp

this... seems to only happen intermittently? doesn't make any sense.

hjwp avatar Jun 21 '18 16:06 hjwp