class_docstr: The CLI runner provides functionality to invoke a Click command line
  script for unittesting purposes in a isolated environment.  This only
  works in single-threaded systems without any concurrency as it changes the
  global interpreter state.
  
  :param charset: the character set for the input and output data.  This is
                  UTF-8 by default and should not be changed currently as
                  the reporting to Click only works in Python 2 properly.
  :param env: a dictionary with environment variables for overriding.
  :param echo_stdin: if this is set to `True`, then reading from stdin writes
                     to stdout.  This is useful for showing examples in
                     some circumstances.  Note that regular prompts
                     will automatically echo the input.
  :param mix_stderr: if this is set to `False`, then stdout and stderr are
                     preserved as independent streams.  This is useful for
                     Unix-philosophy apps that have predictable stdout and
                     noisy stderr, such that each may be measured
                     independently
docstr: Invokes a command in an isolated environment.  The arguments are
  forwarded directly to the command line script, the `extra` keyword
  arguments are passed to the :meth:`~clickpkg.Command.main` function of
  the command.
  
  This returns a :class:`Result` object.
  
  .. versionadded:: 3.0
     The ``catch_exceptions`` parameter was added.
  
  .. versionchanged:: 3.0
     The result object now has an `exc_info` attribute with the
     traceback if available.
  
  .. versionadded:: 4.0
     The ``color`` parameter was added.
  
  :param cli: the command to invoke
  :param args: the arguments to invoke. It may be given as an iterable
               or a string. When given as string it will be interpreted
               as a Unix shell command. More details at
               :func:`shlex.split`.
  :param input: the input data for `sys.stdin`.
  :param env: the environment overrides.
  :param catch_exceptions: Whether to catch any other exceptions than
                           ``SystemExit``.
  :param extra: the keyword arguments to pass to :meth:`main`.
  :param color: whether the output should contain color codes. The
                application can still override this explicitly.
code: def invoke(
      self,
      cli,
      args=None,
      input=None,
      env=None,
      catch_exceptions=True,
      color=False,
      **extra,
  ):
      """Invokes a command in an isolated environment.  The arguments are
      forwarded directly to the command line script, the `extra` keyword
      arguments are passed to the :meth:`~clickpkg.Command.main` function of
      the command.
  
      This returns a :class:`Result` object.
  
      .. versionadded:: 3.0
         The ``catch_exceptions`` parameter was added.
  
      .. versionchanged:: 3.0
         The result object now has an `exc_info` attribute with the
         traceback if available.
  
      .. versionadded:: 4.0
         The ``color`` parameter was added.
  
      :param cli: the command to invoke
      :param args: the arguments to invoke. It may be given as an iterable
                   or a string. When given as string it will be interpreted
                   as a Unix shell command. More details at
                   :func:`shlex.split`.
      :param input: the input data for `sys.stdin`.
      :param env: the environment overrides.
      :param catch_exceptions: Whether to catch any other exceptions than
                               ``SystemExit``.
      :param extra: the keyword arguments to pass to :meth:`main`.
      :param color: whether the output should contain color codes. The
                    application can still override this explicitly.
      """
      exc_info = None
      with self.isolation(
          input=input, env=env, color=color
      ) as outstreams:
          exception = None
          exit_code = 0
  
          if isinstance(args, string_types):
              args = shlex.split(args)
  
          try:
              prog_name = extra.pop("prog_name")
          except KeyError:
              prog_name = self.get_default_prog_name(cli)
  
          try:
              cli.main(args=args or (), prog_name=prog_name, **extra)
          except SystemExit as e:
              exc_info = sys.exc_info()
              exit_code = e.code
              if exit_code is None:
                  exit_code = 0
  
              if exit_code != 0:
                  exception = e
  
              if not isinstance(exit_code, int):
                  sys.stdout.write(str(exit_code))
                  sys.stdout.write("\n")
                  exit_code = 1
  
          except Exception as e:
              if not catch_exceptions:
                  raise
              exception = e
              exit_code = 1
              exc_info = sys.exc_info()
          finally:
              sys.stdout.flush()
              stdout = outstreams[0].getvalue()
              if self.mix_stderr:
                  stderr = None
              else:
                  stderr = outstreams[1].getvalue()
  
      return Result(
          runner=self,
          stdout_bytes=stdout,
          stderr_bytes=stderr,
          exit_code=exit_code,
          exception=exception,
          exc_info=exc_info,
      )
  
imports: import contextlib
  import os
  import shlex
  import shutil
  import sys
  import tempfile
  from .None import formatting
  from .None import termui
  from .None import utils
  from ._compat import iteritems
  from ._compat import PY2
  from ._compat import string_types
label_desc: Use image node_id 5 for calling the CliRunner obj's underlying member method code with example usage: obj.invoke(cli, args, input, env, catch_exceptions, color) and returns: Result