(
self, pytester: Pytester, run_and_parse: RunAndParse, xunit_family: str
)
| 375 | |
| 376 | @parametrize_families |
| 377 | def test_teardown_error( |
| 378 | self, pytester: Pytester, run_and_parse: RunAndParse, xunit_family: str |
| 379 | ) -> None: |
| 380 | pytester.makepyfile( |
| 381 | """ |
| 382 | import pytest |
| 383 | |
| 384 | @pytest.fixture |
| 385 | def arg(): |
| 386 | yield |
| 387 | raise ValueError('Error reason') |
| 388 | def test_function(arg): |
| 389 | pass |
| 390 | """ |
| 391 | ) |
| 392 | result, dom = run_and_parse(family=xunit_family) |
| 393 | assert result.ret |
| 394 | node = dom.get_first_by_tag("testsuite") |
| 395 | node.assert_attr(errors=1, tests=1) |
| 396 | tnode = node.get_first_by_tag("testcase") |
| 397 | tnode.assert_attr(classname="test_teardown_error", name="test_function") |
| 398 | fnode = tnode.get_first_by_tag("error") |
| 399 | fnode.assert_attr(message='failed on teardown with "ValueError: Error reason"') |
| 400 | assert "ValueError" in fnode.toxml() |
| 401 | |
| 402 | @parametrize_families |
| 403 | def test_call_failure_teardown_error( |
nothing calls this directly
no test coverage detected