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

Method test_summing_simple

testing/test_junitxml.py:976–1001  ·  view source on GitHub ↗
(
        self, pytester: Pytester, run_and_parse: RunAndParse, xunit_family: str
    )

Source from the content-addressed store, hash-verified

974class TestNonPython:
975 @parametrize_families
976 def test_summing_simple(
977 self, pytester: Pytester, run_and_parse: RunAndParse, xunit_family: str
978 ) -> None:
979 pytester.makeconftest(
980 """
981 import pytest
982 def pytest_collect_file(file_path, parent):
983 if file_path.suffix == ".xyz":
984 return MyItem.from_parent(name=file_path.name, parent=parent)
985 class MyItem(pytest.Item):
986 def runtest(self):
987 raise ValueError(42)
988 def repr_failure(self, excinfo):
989 return "custom item runtest failed"
990 """
991 )
992 pytester.path.joinpath("myfile.xyz").write_text("hello")
993 result, dom = run_and_parse(family=xunit_family)
994 assert result.ret
995 node = dom.find_first_by_tag("testsuite")
996 node.assert_attr(errors=0, failures=1, skipped=0, tests=1)
997 tnode = node.find_first_by_tag("testcase")
998 tnode.assert_attr(name="myfile.xyz")
999 fnode = tnode.find_first_by_tag("failure")
1000 fnode.assert_attr(message="custom item runtest failed")
1001 assert "custom item runtest failed" in fnode.toxml()
1002
1003
1004@pytest.mark.parametrize("junit_logging", ["no", "system-out"])

Callers

nothing calls this directly

Calls 5

run_and_parseFunction · 0.85
find_first_by_tagMethod · 0.80
assert_attrMethod · 0.80
toxmlMethod · 0.80
makeconftestMethod · 0.45

Tested by

no test coverage detected