def test_already_initialized_crash(pytester: Pytester) -> None:
    """Even if faulthandler is already initialized, we still dump tracebacks on crashes (#8258)."""
    pytester.makepyfile(
        """
        def test():
            import faulthandler
            faulthandler._sigabrt()
    """
    )
    result = pytester.run(
        sys.executable,
        "-X",
        "faulthandler",
        "-mpytest",
        pytester.path,
    )
    result.stderr.fnmatch_lines(["*Fatal Python error*"])
    assert result.ret != 0
Even if faulthandler is already initialized, we still dump tracebacks on crashes (#8258).
testing/test_faulthandler.py