code: 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(["*%s*" % tb_output])
      else:
          assert tb_output not in result.stderr.str()
      result.stdout.fnmatch_lines(["*1 passed*"])
      assert result.ret == 0
  
file_path: pytest/testing/test_faulthandler.py
imports: import io
  import sys
  import pytest
  from _pytest.pytester import Pytester
label_desc: Use image node_id 6 for calling a global function with example usage: test_timeout(pytester, enabled) without return types