Skip to content
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

junitxml not picking up user_properties in case of failure in call and error in teardown #6826

Open
schoi119 opened this issue Feb 27, 2020 · 0 comments
Labels
plugin: junitxml related to the junitxml builtin plugin type: bug problem that needs to be addressed

Comments

@schoi119
Copy link

schoi119 commented Feb 27, 2020

JunitXML is not picking up user_properties for the new test case that's created when there is a failure in call and error in teardown.

Here is where it opens a new test case.
https://github.com/pytest-dev/pytest/blob/master/src/_pytest/junitxml.py#L561

We need to do what's done here
https://github.com/pytest-dev/pytest/blob/master/src/_pytest/junitxml.py#L583
after line 561 to add user_properties to close_report as well.

To reproduce the issue

conftest.py

def pytest_collection_modifyitems(items):
    for item in items:
        item.user_properties.append(('key', 'value'))

test_sample.py

import pytest

@pytest.fixture(scope="function")
def some_fixture():
    yield None
    1/0

@pytest.mark.tc91
def test_sample1(some_fixture):
    assert False

run pytest test_sample.py --junitxml=test.xml
You will see that in the first test case in test.xml, there is no property set, where as the second one has it.

I am using pytest 5.3.5

@Zac-HD Zac-HD added plugin: junitxml related to the junitxml builtin plugin type: bug problem that needs to be addressed labels Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: junitxml related to the junitxml builtin plugin type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

2 participants