(pytester: Pytester, xunit_family: str)
| 1556 | |
| 1557 | @parametrize_families |
| 1558 | def 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 | |
| 1592 | def test_url_property(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected