MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_record_fixtures_xunit2

Function test_record_fixtures_xunit2

testing/test_junitxml.py:1299–1335  ·  view source on GitHub ↗

Ensure record_xml_attribute and record_property drop values when outside of legacy family.

(
    pytester: Pytester, fixture_name: str, run_and_parse: RunAndParse
)

Source from the content-addressed store, hash-verified

1297@pytest.mark.filterwarnings("default")
1298@pytest.mark.parametrize("fixture_name", ["record_xml_attribute", "record_property"])
1299def test_record_fixtures_xunit2(
1300 pytester: Pytester, fixture_name: str, run_and_parse: RunAndParse
1301) -> None:
1302 """Ensure record_xml_attribute and record_property drop values when outside of legacy family."""
1303 pytester.makeini(
1304 """
1305 [pytest]
1306 junit_family = xunit2
1307 """
1308 )
1309 pytester.makepyfile(
1310 """
1311 import pytest
1312
1313 @pytest.fixture
1314 def other({fixture_name}):
1315 {fixture_name}("bar", 1)
1316 def test_record({fixture_name}, other):
1317 {fixture_name}("foo", "<1");
1318 """.format(
1319 fixture_name=fixture_name
1320 )
1321 )
1322
1323 result, dom = run_and_parse(family=None)
1324 expected_lines = []
1325 if fixture_name == "record_xml_attribute":
1326 expected_lines.append(
1327 "*test_record_fixtures_xunit2.py:6:*record_xml_attribute is an experimental feature"
1328 )
1329 expected_lines = [
1330 "*test_record_fixtures_xunit2.py:6:*{fixture_name} is incompatible "
1331 "with junit_family 'xunit2' (use 'legacy' or 'xunit1')".format(
1332 fixture_name=fixture_name
1333 )
1334 ]
1335 result.stdout.fnmatch_lines(expected_lines)
1336
1337
1338def test_random_report_log_xdist(

Callers

nothing calls this directly

Calls 6

run_and_parseFunction · 0.85
appendMethod · 0.80
fnmatch_linesMethod · 0.80
makeiniMethod · 0.45
makepyfileMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected