code: def apidoc(rootdir, tmp_path, apidoc_params):
      _, kwargs = apidoc_params
      coderoot = rootdir / kwargs.get("coderoot", "test-root")
      outdir = tmp_path / "out"
      excludes = [str(coderoot / e) for e in kwargs.get("excludes", [])]
      args = (
          ["-o", str(outdir), "-F", str(coderoot)]
          + excludes
          + kwargs.get("options", [])
      )
      apidoc_main(args)
      return namedtuple("apidoc", "coderoot,outdir")(coderoot, outdir)
  
imports: import os.path
  from collections import namedtuple
  import pytest
  import sphinx.ext.apidoc
  from sphinx.ext.apidoc import main
label_desc: Use image node_id 1 for calling a global function with example usage: apidoc(rootdir, tmp_path, apidoc_params) and returns: namedtuple