Skip to content

pytest 2.8.0 + xdist-1.13.1 writes incorrect junit-xml #1064

@dgrunwald

Description

@dgrunwald

Using python 2.7.10, pytest 2.8.0 and pytest-xdist 1.13.1.

Testcase:

import pytest, time

@pytest.mark.parametrize('i', list(range(100)))
def test_x(i):
    print(i)
    time.sleep(i/300.0)
    assert i != 42

Run with pytest -n 8 --junit-xml=junit.xml.
The output on the command line looks fine, showing the test_x[42] failure.
But look at the resulting junit.xml file: the failure appears in the wrong <testcase> node:

<testcase classname="test_x" file="test_x.py" line="2" name="test_x[54]" time="0.141129970551"><failure message="i = 42 [...]</failure><system-out>42
</system-out></testcase>

This causes test failures to be listed incorrectly in our Jenkins CI.
The other <system-out> nodes also appear in the wrong <testcase> nodes.

The bug disappears when downgrading pytest to 2.7.3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions