(
self, pytester: Pytester, run_and_parse: RunAndParse, xunit_family: str
)
| 282 | |
| 283 | @parametrize_families |
| 284 | def test_setup_error( |
| 285 | self, pytester: Pytester, run_and_parse: RunAndParse, xunit_family: str |
| 286 | ) -> None: |
| 287 | pytester.makepyfile( |
| 288 | """ |
| 289 | import pytest |
| 290 | |
| 291 | @pytest.fixture |
| 292 | def arg(request): |
| 293 | raise ValueError("Error reason") |
| 294 | def test_function(arg): |
| 295 | pass |
| 296 | """ |
| 297 | ) |
| 298 | result, dom = run_and_parse(family=xunit_family) |
| 299 | assert result.ret |
| 300 | node = dom.find_first_by_tag("testsuite") |
| 301 | node.assert_attr(errors=1, tests=1) |
| 302 | tnode = node.find_first_by_tag("testcase") |
| 303 | tnode.assert_attr(classname="test_setup_error", name="test_function") |
| 304 | fnode = tnode.find_first_by_tag("error") |
| 305 | fnode.assert_attr(message='failed on setup with "ValueError: Error reason"') |
| 306 | assert "ValueError" in fnode.toxml() |
| 307 | |
| 308 | @parametrize_families |
| 309 | def test_teardown_error( |
nothing calls this directly
no test coverage detected