def test_timeout(pytester: Pytester, enabled: bool) -> None:
    """Test option to dump tracebacks after a certain timeout.

    If faulthandler is disabled, no traceback will be dumped.
    """
    pytester.makepyfile(
        """
    import os, time
    def test_timeout():
        time.sleep(1 if "CI" in os.environ else 0.1)
    """
    )
    pytester.makeini(
        """
        [pytest]
        faulthandler_timeout = 0.01
        """
    )
    args = ["-p", "no:faulthandler"] if not enabled else []

    result = pytester.runpytest_subprocess(*args)
    tb_output = "most recent call first"
    if enabled:
        result.stderr.fnmatch_lines([f"*{tb_output}*"])
    else:
        assert tb_output not in result.stderr.str()
    result.stdout.fnmatch_lines(["*1 passed*"])
    assert result.ret == 0
Test option to dump tracebacks after a certain timeout.

    If faulthandler is disabled, no traceback will be dumped.
    
testing/test_faulthandler.py