Coverage for typer / testing.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-03-26 21:46 +0000

1from collections.abc import Mapping, Sequence 1abcdefg

2from typing import IO, Any 1abcdefg

3 

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

5from click.testing import Result 1abcdefg

6from typer.main import Typer 1abcdefg

7from typer.main import get_command as _get_command 1abcdefg

8 

9 

10class CliRunner(ClickCliRunner): 1abcdefg

11 def invoke( # type: ignore 1abcdefg

12 self, 

13 app: Typer, 

14 args: str | Sequence[str] | None = None, 

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

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

17 catch_exceptions: bool = True, 

18 color: bool = False, 

19 **extra: Any, 

20 ) -> Result: 

21 use_cli = _get_command(app) 1abcdefg

22 return super().invoke( 1abcdefg

23 use_cli, 

24 args=args, 

25 input=input, 

26 env=env, 

27 catch_exceptions=catch_exceptions, 

28 color=color, 

29 **extra, 

30 )