(
self, pytester: Pytester, run_and_parse: RunAndParse, xunit_family: str
)
| 974 | class 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"]) |
nothing calls this directly
no test coverage detected