[py-dev] XML Parsing Error when esc characters are in traceback

Anton P anton7811 at gmail.com
Mon Mar 5 10:56:40 CET 2012


Thank you!
I've checked that.


2012/3/2 holger krekel <holger at merlinux.eu>:
> Hi Anton,
>
> guess you know it - Ronny opened a bug on this issue and you
> might want to follow it. See
>
> https://bitbucket.org/hpk42/pytest/issue/126/junitxml-doesnt-escape-everything
>
> holger
>
> On Wed, Feb 22, 2012 at 13:10 +0200, Anton P wrote:
>> Hello all,
>>
>> I have the following issue with generated junitxml reports:
>>
>> I'm writing test cases which use scapy functions. So I make asserts on
>> some packet objects. As I understand scapy uses esc characters for its
>> own objects representation, and I can see colorful output on the
>> console. But when test is failed, and its traceback went to xml, I
>> can't open generated xml due to the error "XML Parsing Error: not
>> well-formed" In my case the problem with esc charecter 033 (\x1b).
>> I resolved the issue by adding the following code to append_failure
>> method in LogXML class:
>> longrepr = str(report.longrepr).replace('\x1b', '\\033')
>> fail.append(longrepr)
>>
>> I think that it will be good if you add some cleanup functions to
>> avoid such situations.
>>
>> Thank you,
>>
>> -Anton
>> _______________________________________________
>> py-dev mailing list
>> py-dev at codespeak.net
>> http://codespeak.net/mailman/listinfo/py-dev
>>



More information about the Pytest-dev mailing list