code: def test_collection_warnings(pytester: Pytester) -> None:
      """Check that we also capture warnings issued during test collection (#3251)."""
      pytester.makepyfile(
          """
          import warnings
  
          warnings.warn(UserWarning("collection warning"))
  
          def test_foo():
              pass
      """
      )
      result = pytester.runpytest()
      result.stdout.fnmatch_lines(
          [
              "*== %s ==*" % WARNINGS_SUMMARY_HEADER,
              "  *collection_warnings.py:3: UserWarning: collection warning",
              '    warnings.warn(UserWarning("collection warning"))',
              "* 1 passed, 1 warning*",
          ]
      )
  
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 12 for calling a global function with example usage: test_collection_warnings(pytester) without return types