docstr: Mostly borrowed from argcomplete's unit test fixtures
  
  Set up environment variables to mimic those passed by argcomplete
docstr_tok: ["Mostly","borrowed","from","argcomplete","'s","unit","test","fixtures","Set","up","environment","variables","to","mimic","those","passed","by","argcomplete"]
code: def argcomplete_on(self, mocker):
      """Mostly borrowed from argcomplete's unit test fixtures
  
      Set up environment variables to mimic those passed by argcomplete
      """
      _old_environ = os.environ
      os.environ = os.environ.copy()  # type: ignore[assignment]
      os.environ["_ARGCOMPLETE"] = "1"
      os.environ["_ARC_DEBUG"] = "yes"
      os.environ["IFS"] = self.IFS
      os.environ["_ARGCOMPLETE_COMP_WORDBREAKS"] = self.COMP_WORDBREAKS
  
      # argcomplete==2.0.0 always calls fdopen(9, "w") to open a debug stream,
      # however this could conflict with file descriptors used by pytest
      # and lead to obscure errors. Since we are not looking at debug stream
      # in these tests, just mock this fdopen call out.
      mocker.patch("os.fdopen")
      try:
          yield
      finally:
          os.environ = _old_environ
  
imports: import io
  import os
  import typing
  import pytest
  from traitlets import Unicode
  from traitlets.config.application import Application
  from traitlets.config.configurable import Configurable
  from traitlets.config.loader import KVArgParseConfigLoader
label_desc: Use image node_id 1 for calling the TestArgcomplete obj's underlying member method code with example usage: obj.argcomplete_on(mocker) without return types