Adds xunit2 version of test_record_attribute

This commit is contained in:
Joseph Hunkeler 2019-01-14 13:21:06 -05:00
parent aaa7d36bc9
commit 4ecf29380a
No known key found for this signature in database
GPG Key ID: 5C1D2774D4689768
1 changed files with 38 additions and 0 deletions

View File

@ -980,6 +980,12 @@ def test_record_property_same_name(testdir):
@pytest.mark.filterwarnings("default") @pytest.mark.filterwarnings("default")
def test_record_attribute(testdir): def test_record_attribute(testdir):
testdir.makeini(
"""
[pytest]
junit_family = xunit1
"""
)
testdir.makepyfile( testdir.makepyfile(
""" """
import pytest import pytest
@ -1001,6 +1007,38 @@ def test_record_attribute(testdir):
) )
@pytest.mark.filterwarnings("default")
def test_record_attribute_xunit2(testdir):
"""Ensure record_xml_attribute drops values when outside of legacy family
"""
testdir.makeini(
"""
[pytest]
junit_family = xunit2
"""
)
testdir.makepyfile(
"""
import pytest
@pytest.fixture
def other(record_xml_attribute):
record_xml_attribute("bar", 1)
def test_record(record_xml_attribute, other):
record_xml_attribute("foo", "<1");
"""
)
result, dom = runandparse(testdir, "-rw")
result.stdout.fnmatch_lines(
[
"*test_record_attribute_xunit2.py:6:*record_xml_attribute is an experimental feature",
"*test_record_attribute_xunit2.py:6:*record_xml_attribute is incompatible with "
"junit_family: xunit2 (use: legacy|xunit1)",
]
)
def test_random_report_log_xdist(testdir, monkeypatch): def test_random_report_log_xdist(testdir, monkeypatch):
"""xdist calls pytest_runtest_logreport as they are executed by the slaves, """xdist calls pytest_runtest_logreport as they are executed by the slaves,
with nodes from several nodes overlapping, so junitxml must cope with that with nodes from several nodes overlapping, so junitxml must cope with that