Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dgrunwald opened this issue Sep 25, 2015 · 1 comment
Closed

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

dgrunwald opened this issue Sep 25, 2015 · 1 comment
Labels
type: bug problem that needs to be addressed
Milestone

Comments

@dgrunwald
Copy link

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.

@nicoddemus nicoddemus added this to the 2.8.1 milestone Sep 25, 2015
@nicoddemus nicoddemus added the type: bug problem that needs to be addressed label Sep 25, 2015
@nicoddemus
Copy link
Member

Thanks for the reproducible example, seems it can easily become a functional test! 😄

nicoddemus added a commit to nicoddemus/pytest that referenced this issue Sep 26, 2015
pytest_runtest_logreport must be careful to not depend on setup/call/teardown
being called sequentially in that order, as xdist will call them as they are reported
from the slaves

Fix pytest-dev#1064
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

2 participants