Merge lp://qastaging/~gz/pyjunitxml/ensure_well_formed_xml_625589 into lp://qastaging/pyjunitxml

Proposed by Martin Packman
Status: Merged
Merged at revision: 21
Proposed branch: lp://qastaging/~gz/pyjunitxml/ensure_well_formed_xml_625589
Merge into: lp://qastaging/pyjunitxml
Diff against target: 275 lines (+181/-9) (has conflicts)
2 files modified
junitxml/__init__.py (+57/-9)
junitxml/tests/test_junitxml.py (+124/-0)
Text conflict in junitxml/__init__.py
Text conflict in junitxml/tests/test_junitxml.py
To merge this branch: bzr merge lp://qastaging/~gz/pyjunitxml/ensure_well_formed_xml_625589
Reviewer Review Type Date Requested Status
Robert Collins Needs Fixing
Vincent Ladeuil Approve
Review via email: mp+34573@code.qastaging.launchpad.net

Description of the change

Fixes the escaping function to be properly robust against arbitrary input, and to output utf-8 bytestrings on Python 2.

There are a couple of judgement calls in how this escaping is written. Firstly, invalid cdata is stripped rather than included in some escaped form in the output. Without resorting to clever things that would require the junit xml format there's always the potential for confusing output like "AssertionError: '' != ''" but that's not much worse than "AssertionError: '\x00' != '\x00'" or similar. Also, \r is stripped even though it may appear in xml content, this is largely because of how parsing handles it anyway.

This branch builds on lp:~gz/pyjunitxml/unexpected_expectations_python_2.7 and p:~gz/pyjunitxml/source_compat_python_3 but launchpad doesn't like multiple prerequisite branches.

To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) wrote :

Woohoo ! Makes babune happy :-)

First time we get an actual Test Result, compare:
  http://babune.ladeuil.net:24842/job/selftest-windows/153/
with
  http://babune.ladeuil.net:24842/job/selftest-windows/154/

I will be running with this branch for all other platforms to check
against regressions.

review: Approve
Revision history for this message
Martin Packman (gz) wrote :

> Woohoo ! Makes babune happy :-)

Ah, great, I was going to ask you to give this a go tomorrow.

> First time we get an actual Test Result, compare:
> http://babune.ladeuil.net:24842/job/selftest-windows/153/
> with
> http://babune.ladeuil.net:24842/job/selftest-windows/154/
>
> I will be running with this branch for all other platforms to check
> against regressions.

Went to check if maverick was now working as well, and apparently it was already made happy by fixing the elementtree thing. The testing is better for this when there are lots of different things going wrong with the test suite. :)

Revision history for this message
Vincent Ladeuil (vila) wrote :

@Robert: ping, this has been working well on babune for the last days. Anything else needed to land ?

Revision history for this message
Robert Collins (lifeless) wrote :

Fails selftest:

:!python -m testtools.run junitxml.test_suite
Tests running...
======================================================================
ERROR: junitxml.tests.test_junitxml.TestWellFormedXml.test_error_with_surrogates
----------------------------------------------------------------------
Traceback (most recent call last):
  File "junitxml/tests/test_junitxml.py", line 313, in test_error_with_surrogates
    self.assertTrue(unichr(0x201A2) in traceback)
UnboundLocalError: local variable 'unichr' referenced before assignment
Ran 18 tests in 0.007s

Also has conflicts in trunk, but they are shallow.

review: Needs Fixing
Revision history for this message
Robert Collins (lifeless) wrote :

And needs NEWS

21. By Martin Packman

Don't create a local unichr for test in Python 3 instead use expected string

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: