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

Function test_global_properties

testing/test_junitxml.py:1558–1589  ·  view source on GitHub ↗
(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("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 = "test_node_id"
1565
1566 log.pytest_sessionstart()
1567 log.add_global_property("foo", "1")
1568 log.add_global_property("bar", "2")
1569 log.pytest_sessionfinish()
1570
1571 dom = minidom.parse(str(path))
1572
1573 properties = dom.getElementsByTagName("properties")
1574
1575 assert properties.length == 1, "There must be one <properties> node"
1576
1577 property_list = dom.getElementsByTagName("property")
1578
1579 assert property_list.length == 2, "There most be only 2 property nodes"
1580
1581 expected = {"foo": "1", "bar": "2"}
1582 actual = {}
1583
1584 for p in property_list:
1585 k = str(p.getAttribute("name"))
1586 v = str(p.getAttribute("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

Used in the wild real call sites across dependent graphs

searching dependent graphs…