(pytester: Pytester, xunit_family: str)
| 1464 | |
| 1465 | @parametrize_families |
| 1466 | def 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 | |
| 1500 | def test_url_property(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected