code: def test_warning_recorded_hook(pytester: Pytester) -> None:
      pytester.makeconftest(
          """
          def pytest_configure(config):
              config.issue_config_time_warning(UserWarning("config warning"), stacklevel=2)
      """
      )
      pytester.makepyfile(
          """
          import pytest, warnings
  
          warnings.warn(UserWarning("collect warning"))
  
          @pytest.fixture
          def fix():
              warnings.warn(UserWarning("setup warning"))
              yield 1
              warnings.warn(UserWarning("teardown warning"))
  
          def test_func(fix):
              warnings.warn(UserWarning("call warning"))
              assert fix == 1
          """
      )
  
      collected = []
  
      class WarningCollector:
          def pytest_warning_recorded(
              self, warning_message, when, nodeid, location
          ):
              collected.append(
                  (str(warning_message.message), when, nodeid, location)
              )
  
      result = pytester.runpytest(plugins=[WarningCollector()])
      result.stdout.fnmatch_lines(["*1 passed*"])
  
      expected = [
          ("config warning", "config", ""),
          ("collect warning", "collect", ""),
          (
              "setup warning",
              "runtest",
              "test_warning_recorded_hook.py::test_func",
          ),
          (
              "call warning",
              "runtest",
              "test_warning_recorded_hook.py::test_func",
          ),
          (
              "teardown warning",
              "runtest",
              "test_warning_recorded_hook.py::test_func",
          ),
      ]
      for index in range(len(expected)):
          collected_result = collected[index]
          expected_result = expected[index]
  
          assert collected_result[0] == expected_result[0], str(
              collected
          )
          assert collected_result[1] == expected_result[1], str(
              collected
          )
          assert collected_result[2] == expected_result[2], str(
              collected
          )
  
          # NOTE: collected_result[3] is location, which differs based on the platform you are on
          #       thus, the best we can do here is assert the types of the parameters match what we expect
          #       and not try and preload it in the expected array
          if collected_result[3] is not None:
              assert type(collected_result[3][0]) is str, str(collected)
              assert type(collected_result[3][1]) is int, str(collected)
              assert type(collected_result[3][2]) is str, str(collected)
          else:
              assert collected_result[3] is None, str(collected)
  
imports: import os
  import sys
  import warnings
  from typing import List
  from typing import Optional
  from typing import Tuple
  import pytest
  from _pytest.fixtures import FixtureRequest
  from _pytest.pytester import Pytester
label_desc: Use image node_id 11 for calling a global function with example usage: test_warning_recorded_hook(pytester) without return types