Coverage for typer / testing.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-02-09 12:36 +0000

1from collections.abc import Mapping, Sequence 1abcdefgh

2from typing import IO, Any, Optional, Union 1abcdefgh

3 

4from click.testing import CliRunner as ClickCliRunner # noqa 1abcdefgh

5from click.testing import Result 1abcdefgh

6from typer.main import Typer 1abcdefgh

7from typer.main import get_command as _get_command 1abcdefgh

8 

9 

10class CliRunner(ClickCliRunner): 1abcdefgh

11 def invoke( # type: ignore 1abcdefgh

12 self, 

13 app: Typer, 

14 args: Optional[Union[str, Sequence[str]]] = None, 

15 input: Optional[Union[bytes, str, IO[Any]]] = None, 

16 env: Optional[Mapping[str, Optional[str]]] = None, 

17 catch_exceptions: bool = True, 

18 color: bool = False, 

19 **extra: Any, 

20 ) -> Result: 

21 use_cli = _get_command(app) 1abcdefgh

22 return super().invoke( 1abcdefgh

23 use_cli, 

24 args=args, 

25 input=input, 

26 env=env, 

27 catch_exceptions=catch_exceptions, 

28 color=color, 

29 **extra, 

30 )