def test_record_fixtures_xunit2(
    pytester: Pytester, fixture_name: str, run_and_parse: RunAndParse
) -> None:
    """Ensure record_xml_attribute and record_property drop values when outside of legacy family."""
    pytester.makeini(
        """
        [pytest]
        junit_family = xunit2
    """
    )
    pytester.makepyfile(
        f"""
        import pytest

        @pytest.fixture
        def other({fixture_name}):
            {fixture_name}("bar", 1)
        def test_record({fixture_name}, other):
            {fixture_name}("foo", "<1");
    """
    )

    result, dom = run_and_parse(family=None)
    expected_lines = []
    if fixture_name == "record_xml_attribute":
        expected_lines.append(
            "*test_record_fixtures_xunit2.py:6:*record_xml_attribute is an experimental feature"
        )
    expected_lines = [
        f"*test_record_fixtures_xunit2.py:6:*{fixture_name} is incompatible "
        "with junit_family 'xunit2' (use 'legacy' or 'xunit1')"
    ]
    result.stdout.fnmatch_lines(expected_lines)
Ensure record_xml_attribute and record_property drop values when outside of legacy family.
testing/test_junitxml.py