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

Function test_crash_during_shutdown_captured

testing/test_faulthandler.py:33–42  ·  view source on GitHub ↗

Re-enable faulthandler if pytest encountered it enabled during configure. We should be able to then see crashes during interpreter shutdown.

(pytester: Pytester)

Source from the content-addressed store, hash-verified

31
32
33def test_crash_during_shutdown_captured(pytester: Pytester) -> None:
34 """
35 Re-enable faulthandler if pytest encountered it enabled during configure.
36 We should be able to then see crashes during interpreter shutdown.
37 """
38 setup_crashing_test(pytester)
39 args = (sys.executable, "-Xfaulthandler", "-mpytest")
40 result = pytester.run(*args)
41 result.stderr.fnmatch_lines(["*Fatal Python error*"])
42 assert result.ret != 0
43
44
45def test_crash_during_shutdown_not_captured(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 3

setup_crashing_testFunction · 0.85
fnmatch_linesMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected