MCPcopy
hub / github.com/pytest-dev/pytest / test_global_properties

Function test_global_properties

testing/test_junitxml.py:1558–1589  ·  testing/test_junitxml.py::test_global_properties
(pytester: Pytester, xunit_family: str)

Source from the content-addressed store, hash-verified

1556
1557@parametrize_families
1558def test_global_properties(pytester: Pytester, xunit_family: str) -> None:
1559 path = pytester.path.joinpath(class="st">"test_global_properties.xml")
1560 log = LogXML(str(path), None, family=xunit_family)
1561
1562 class Report(BaseReport):
1563 sections: list[tuple[str, str]] = []
1564 nodeid = class="st">"test_node_id"
1565
1566 log.pytest_sessionstart()
1567 log.add_global_property(class="st">"foo", class="st">"1")
1568 log.add_global_property(class="st">"bar", class="st">"2")
1569 log.pytest_sessionfinish()
1570
1571 dom = minidom.parse(str(path))
1572
1573 properties = dom.getElementsByTagName(class="st">"properties")
1574
1575 assert properties.length == 1, class="st">"There must be one <properties> node"
1576
1577 property_list = dom.getElementsByTagName(class="st">"property")
1578
1579 assert property_list.length == 2, class="st">"There most be only 2 property nodes"
1580
1581 expected = {class="st">"foo": class="st">"1", class="st">"bar": class="st">"2"}
1582 actual = {}
1583
1584 for p in property_list:
1585 k = str(p.getAttribute(class="st">"name"))
1586 v = str(p.getAttribute(class="st">"value"))
1587 actual[k] = v
1588
1589 assert actual == expected
1590
1591
1592def test_url_property(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 5

pytest_sessionstartMethod · 0.95
add_global_propertyMethod · 0.95
pytest_sessionfinishMethod · 0.95
LogXMLClass · 0.90
parseMethod · 0.45

Tested by

no test coverage detected