code: def test_cfg_override(path=None):
      with chpwd(path):
          # use 'wtf' to dump the config
          # should be rewritten to use `configuration`
          cmd = ["datalad", "wtf", "-S", "configuration", "-s", "some"]
          # control
          out = Runner().run(cmd, protocol=StdOutErrCapture)["stdout"]
          assert_not_in("datalad.dummy: this", out)
          # ensure that this is not a dataset's cfg manager
          assert_not_in("datalad.dataset.id", out)
          # env var
          out = Runner(env=dict(os.environ, DATALAD_DUMMY="this")).run(
              cmd, protocol=StdOutErrCapture
          )["stdout"]
          assert_in("datalad.dummy: this", out)
          # cmdline arg
          out = Runner().run(
              [cmd[0], "-c", "datalad.dummy=this"] + cmd[1:],
              protocol=StdOutErrCapture,
          )["stdout"]
          assert_in("datalad.dummy: this", out)
  
          # now create a dataset in the path. the wtf plugin will switch to
          # using the dataset's config manager, which must inherit the overrides
          create(dataset=path, annex=False)
          # control
          out = Runner().run(cmd, protocol=StdOutErrCapture)["stdout"]
          assert_not_in("datalad.dummy: this", out)
          # ensure that this is a dataset's cfg manager
          assert_in("datalad.dataset.id", out)
          # env var
          out = Runner(env=dict(os.environ, DATALAD_DUMMY="this")).run(
              cmd, protocol=StdOutErrCapture
          )["stdout"]
          assert_in("datalad.dummy: this", out)
          # cmdline arg
          out = Runner().run(
              [cmd[0], "-c", "datalad.dummy=this"] + cmd[1:],
              protocol=StdOutErrCapture,
          )["stdout"]
          assert_in("datalad.dummy: this", out)
  
          # set a config
          run_main(
              [
                  "configuration",
                  "--scope",
                  "local",
                  "set",
                  "mike.item=some",
              ]
          )
          # verify it is successfully set
          assert (
              "some"
              == run_main(["configuration", "get", "mike.item"])[
                  0
              ].strip()
          )
          # verify that an override can unset the config
          # we cannot use run_main(), because the "singleton" instance of the
          # dataset we are in is still around in this session, and with it
          # also its config managers that we will not be able to post-hoc
          # overwrite with this method. Instead, we'll execute in a subprocess.
          assert (
              ""
              == Runner()
              .run(
                  [
                      "datalad",
                      "-c",
                      ":mike.item",
                      "configuration",
                      "get",
                      "mike.item",
                  ],
                  protocol=StdOutErrCapture,
              )["stdout"]
              .strip()
          )
          # verify the effect is not permanent
          assert (
              "some"
              == Runner()
              .run(
                  ["datalad", "configuration", "get", "mike.item"],
                  protocol=StdOutErrCapture,
              )["stdout"]
              .strip()
          )
  
imports: import os
  import re
  from io import StringIO
  from unittest.mock import patch
  import pytest
  import datalad
  from datalad import __version__
  from datalad.api import Dataset, create
  from datalad.cmd import StdOutErrCapture
  from datalad.cmd import WitlessRunner
  from datalad.interface.base import get_interface_groups
  from datalad.tests.utils_pytest import SkipTest, assert_equal, assert_in, assert_not_in, assert_raises, assert_re_in, eq_, in_, ok_, ok_startswith, on_windows, skip_if_no_module, slow, with_tempfile
  from datalad.ui.utils import get_console_width, get_terminal_size
  from datalad.utils import chpwd
  from ..helpers import get_commands_from_groups
  from ..main import main
label_desc: Use image node_id 14 for calling a global function with example usage: test_cfg_override(path) without return types