From 81189d28ae9abd21ffc019cb4248e264c7346713 Mon Sep 17 00:00:00 2001 From: Mohamed Elwasila Date: Fri, 2 Jan 2026 23:36:40 +0000 Subject: [PATCH] docs: fix CliRunner.invoke() docstring to reference 'app' parameter The invoke() method in Typer's CliRunner accepts an 'app' parameter (Typer application) instead of 'cli' (Click command). Updated the docstring to accurately reflect this Typer-specific parameter and clarify that this is a wrapper around Click's CliRunner. --- typer/testing.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/typer/testing.py b/typer/testing.py index 61f337b789..75a77bfdf7 100644 --- a/typer/testing.py +++ b/typer/testing.py @@ -18,6 +18,28 @@ def invoke( # type: ignore color: bool = False, **extra: Any, ) -> Result: + """Invokes a Typer application in an isolated environment. + + This is a Typer-specific wrapper around Click's CliRunner.invoke() method. + The arguments are forwarded directly to the command line script, the `extra` + keyword arguments are passed to the :meth:`~click.Command.main` function of + the command. + + This returns a :class:`click.testing.Result` object. + + :param app: the Typer application 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 color: whether the output should contain color codes. The + application can still override this explicitly. + :param extra: the keyword arguments to pass to :meth:`main`. + """ use_cli = _get_command(app) return super().invoke( use_cli,