Open
Description
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