Skip to content

--junitxml: Escaping < and maybe other special characters #3533

@danwos

Description

@danwos

I just tried to parse an junit-xml file, which was created by pytest.
The parser and also my IDE (PyCharm) claim about not escaped chars.

Here is an example, which was generated by pytest --junitxml:

<testsuite errors="0" failures="0" name="pytest" skips="10" tests="10" time="0.054">
    <testcase classname="setup" file="setup.py" line="-1" name="FLAKE8" time="0.000252246856689">
        <skipped message="file(s) previously passed FLAKE8 checks" type="pytest.skip">
        /some/folders/python2.7/site-packages/pytest_flake8.py:106: <py._xmlgen.raw object at 0x7fd5a8a0e950>
        </skipped>
    </testcase>
</testsuite>

The problem is inside the text of the skipped node.
There is a not escaped < (after the path):
/some/folders/python2.7/site-packages/pytest_flake8.py:106: <py._xmlgen...

I'm not sure, if this bug affects skipped tests only or if < is the only problematic char.

If you are not so familiar with allowed chars in xml (like me), here is a nice SO answer:
https://stackoverflow.com/a/1091953

Finally some details about my installed versions:

platform linux -- Python 3.5.2, pytest-3.6.0, py-1.5.3, pluggy-0.6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueeasy issue that is friendly to new contributorplugin: junitxmlrelated to the junitxml builtin plugintype: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions