code: def test_configs(path=None):
      # set up dataset with registered procedure (c&p from test_basics):
      ds = Dataset(path).create(force=True)
      ds.run_procedure("cfg_yoda")
      # configure dataset to look for procedures in its code folder
      ds.config.add(
          "datalad.locations.dataset-procedures", "code", scope="branch"
      )
  
      # 1. run procedure based on execution guessing by run_procedure:
      ds.run_procedure(spec=["datalad_test_proc", "some_arg"])
      # look for traces
      ok_file_has_content(
          op.join(ds.path, "fromproc.txt"), "some_arg\n"
      )
  
      # 2. now configure specific call format including usage of substitution config
      # for run:
      ds.config.add(
          "datalad.procedures.datalad_test_proc.call-format",
          "%s {script} {ds} {{mysub}} {args}"
          % quote_cmdlinearg(sys.executable),
          scope="branch",
      )
      ds.config.add(
          "datalad.run.substitutions.mysub",
          "dataset-call-config",
          scope="branch",
      )
      # TODO: Should we allow for --inputs/--outputs arguments for run_procedure
      #       (to be passed into run)?
      ds.unlock("fromproc.txt")
      # run again:
      ds.run_procedure(spec=["datalad_test_proc", "some_arg"])
      # look for traces
      ok_file_has_content(
          op.join(ds.path, "fromproc.txt"), "dataset-call-config\n"
      )
  
      # 3. have a conflicting config at user-level, which should override the
      # config on dataset level:
      ds.config.add(
          "datalad.procedures.datalad_test_proc.call-format",
          "%s {script} {ds} local {args}"
          % quote_cmdlinearg(sys.executable),
          scope="local",
      )
      ds.unlock("fromproc.txt")
      # run again:
      ds.run_procedure(spec=["datalad_test_proc", "some_arg"])
      # look for traces
      ok_file_has_content(op.join(ds.path, "fromproc.txt"), "local\n")
  
      # 4. get configured help message:
      r = ds.run_procedure(
          "datalad_test_proc", help_proc=True, on_failure="ignore"
      )
      assert_true(len(r) == 1)
      assert_in_results(r, status="impossible")
  
      ds.config.add(
          "datalad.procedures.datalad_test_proc.help",
          "This is a help message",
          scope="branch",
      )
  
      r = ds.run_procedure("datalad_test_proc", help_proc=True)
      assert_true(len(r) == 1)
      assert_in_results(
          r, message="This is a help message", status="ok"
      )
  
imports: import json
  import os.path
  import sys
  from unittest.mock import patch
  from datalad.api import run_procedure
  from datalad.cmd import KillOutput, WitlessRunner
  from datalad.distribution.dataset import Dataset
  from datalad.support.exceptions import CommandError, InsufficientArgumentsError
  from datalad.tests.utils_pytest import OBSCURE_FILENAME, assert_false, assert_in_results, assert_not_in_results, assert_raises, assert_repo_status, assert_result_count, assert_true, eq_, known_failure_windows, ok_file_has_content, patch_config, with_tempfile, with_tree, xfail_buggy_annex_info
  from datalad.utils import chpwd, quote_cmdlinearg, swallow_outputs
label_desc: Use image node_id 5 for calling a global function with example usage: test_configs(path) without return types