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

Method test_call_failure_teardown_error

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

Source from the content-addressed store, hash-verified

332
333 @parametrize_families
334 def test_call_failure_teardown_error(
335 self, pytester: Pytester, run_and_parse: RunAndParse, xunit_family: str
336 ) -> None:
337 pytester.makepyfile(
338 """
339 import pytest
340
341 @pytest.fixture
342 def arg():
343 yield
344 raise Exception("Teardown Exception")
345 def test_function(arg):
346 raise Exception("Call Exception")
347 """
348 )
349 result, dom = run_and_parse(family=xunit_family)
350 assert result.ret
351 node = dom.find_first_by_tag("testsuite")
352 node.assert_attr(errors=1, failures=1, tests=1)
353 first, second = dom.find_by_tag("testcase")
354 assert first
355 assert second
356 assert first != second
357 fnode = first.find_first_by_tag("failure")
358 fnode.assert_attr(message="Exception: Call Exception")
359 snode = second.find_first_by_tag("error")
360 snode.assert_attr(
361 message='failed on teardown with "Exception: Teardown Exception"'
362 )
363
364 @parametrize_families
365 def test_skip_contains_name_reason(

Callers

nothing calls this directly

Calls 5

run_and_parseFunction · 0.85
find_first_by_tagMethod · 0.80
assert_attrMethod · 0.80
find_by_tagMethod · 0.80
makepyfileMethod · 0.45

Tested by

no test coverage detected