(
self,
*args: str | os.PathLike[str],
family: str | None = "xunit1",
suite_name: str = "pytest",
)
| 39 | self.schema = schema |
| 40 | |
| 41 | def __call__( |
| 42 | self, |
| 43 | *args: str | os.PathLike[str], |
| 44 | family: str | None = class="st">"xunit1", |
| 45 | suite_name: str = class="st">"pytest", |
| 46 | ) -> tuple[RunResult, DomDocument]: |
| 47 | if family: |
| 48 | args = (class="st">"-o", class="st">"junit_family=" + family, *args) |
| 49 | xml_path = self.pytester.path.joinpath(class="st">"junit.xml") |
| 50 | result = self.pytester.runpytest(fclass="st">"--junitxml={xml_path}", *args) |
| 51 | if family == class="st">"xunit2": |
| 52 | with xml_path.open(encoding=class="st">"utf-8") as f: |
| 53 | self.schema.validate(f) |
| 54 | xmldoc = minidom.parse(str(xml_path)) |
| 55 | class="cm"># Ensure the tests attribute of the ``<testsuite>`` element |
| 56 | class="cm"># always matches the number of ``<testcase>`` elements (#3580). |
| 57 | doc = DomDocument(xmldoc) |
| 58 | testcase_nodes = doc.find_by_tag(class="st">"testcase") |
| 59 | test_suite_node = doc.get_first_by_tag(class="st">"testsuite") |
| 60 | test_suite_node.assert_attr(name=suite_name, tests=len(testcase_nodes)) |
| 61 | return result, doc |
| 62 | |
| 63 | |
| 64 | @pytest.fixture |
nothing calls this directly
no test coverage detected