Closed
Description
Originally reported by: BitBucket: davebacher, GitHub: davebacher
The following simple test case generates an invalid XML report -- the report contains invalid characters. This issue looks like the same root cause as #267.
I discovered this problem while investigating a failure reported by Jenkins. The invalid XML characters causes Jenkins to fail to parse the XML test report. I originally encountered this problem with py.test 2.3.4, but it also exists in pytest 2.5.0. I'm using Python 2.7.3.
--- test
#!python
'''Test assertion output'''
M1 = '\x01\x02\x03\x04'
M2 = '\x01\x02\x03\x05'
def test_str_compare():
assert M1 == M2 #, "compare M1 and M2"
--- xmllint shows the following errors on the result.xml file
#!shell
$ xmllint result.xml
result.xml:4: parser error : PCDATA invalid Char value 1
E -
^
result.xml:4: parser error : PCDATA invalid Char value 2
E -
^
result.xml:4: parser error : PCDATA invalid Char value 3
E -
^
result.xml:4: parser error : PCDATA invalid Char value 4
E -
^
result.xml:6: parser error : PCDATA invalid Char value 1
E +
^
result.xml:6: parser error : PCDATA invalid Char value 2
E +
^
result.xml:6: parser error : PCDATA invalid Char value 3
E +
^
result.xml:6: parser error : PCDATA invalid Char value 5
E +
^
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
pytestbot commentedon Dec 12, 2013
Original comment by BitBucket: davebacher, GitHub: davebacher:
My current workaround is to specify a failure message when I think the strings might include invalid characters.
pytestbot commentedon Dec 13, 2013
Original comment by Ronny Pfannschmidt (BitBucket: RonnyPfannschmidt, GitHub: RonnyPfannschmidt):
i identified a bug in escaping the assertion analysis information, further investigation is needed to elevate it
pytestbot commentedon Dec 13, 2013
Original comment by Ronny Pfannschmidt (BitBucket: RonnyPfannschmidt, GitHub: RonnyPfannschmidt):
the root cause was using the wrong xml escaping primitive
i locally solved the bug and need to review if there are other missuses
pytestbot commentedon Dec 13, 2013
Original comment by Ronny Pfannschmidt (BitBucket: RonnyPfannschmidt, GitHub: RonnyPfannschmidt):
fix issue404 by more strict junitxml escape