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

Method __call__

testing/test_junitxml.py:41–61  ·  testing/test_junitxml.py::RunAndParse.__call__
(
        self,
        *args: str | os.PathLike[str],
        family: str | None = "xunit1",
        suite_name: str = "pytest",
    )

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

find_by_tagMethod · 0.95
get_first_by_tagMethod · 0.95
DomDocumentClass · 0.85
openMethod · 0.80
assert_attrMethod · 0.80
runpytestMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected