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

Function test_global_properties

testing/test_junitxml.py:1466–1497  ·  view source on GitHub ↗
(pytester: Pytester, xunit_family: str)

Source from the content-addressed store, hash-verified

1464
1465@parametrize_families
1466def test_global_properties(pytester: Pytester, xunit_family: str) -> None:
1467 path = pytester.path.joinpath("test_global_properties.xml")
1468 log = LogXML(str(path), None, family=xunit_family)
1469
1470 class Report(BaseReport):
1471 sections: List[Tuple[str, str]] = []
1472 nodeid = "test_node_id"
1473
1474 log.pytest_sessionstart()
1475 log.add_global_property("foo", "1")
1476 log.add_global_property("bar", "2")
1477 log.pytest_sessionfinish()
1478
1479 dom = minidom.parse(str(path))
1480
1481 properties = dom.getElementsByTagName("properties")
1482
1483 assert properties.length == 1, "There must be one <properties> node"
1484
1485 property_list = dom.getElementsByTagName("property")
1486
1487 assert property_list.length == 2, "There most be only 2 property nodes"
1488
1489 expected = {"foo": "1", "bar": "2"}
1490 actual = {}
1491
1492 for p in property_list:
1493 k = str(p.getAttribute("name"))
1494 v = str(p.getAttribute("value"))
1495 actual[k] = v
1496
1497 assert actual == expected
1498
1499
1500def 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