Skip to content

Commit 4166a41

Browse files
Correct return type of click.testing.CliRunner.isolation() (#5103)
The method returns a tuple of io.BytesIO objects that hold the temporary stdin and stdout. By correcting the type, it allows usages of io.BytesIO.getvalue() to pass type checking. Co-authored-by: Jelle Zijlstra <[email protected]>
1 parent e5abd08 commit 4166a41

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

stubs/click/click/testing.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
from typing import IO, Any, BinaryIO, ContextManager, Dict, Iterable, List, Mapping, Optional, Text, Union
1+
import io
2+
from typing import IO, Any, BinaryIO, ContextManager, Dict, Iterable, List, Mapping, Optional, Text, Tuple, Union
3+
from typing_extensions import Literal
24

35
from .core import BaseCommand
46

@@ -53,7 +55,7 @@ class CliRunner:
5355
def make_env(self, overrides: Optional[Mapping[str, str]] = ...) -> Dict[str, str]: ...
5456
def isolation(
5557
self, input: Optional[Union[bytes, Text, IO[Any]]] = ..., env: Optional[Mapping[str, str]] = ..., color: bool = ...
56-
) -> ContextManager[BinaryIO]: ...
58+
) -> ContextManager[Tuple[io.BytesIO, Union[io.BytesIO, Literal[False]]]]: ...
5759
def invoke(
5860
self,
5961
cli: BaseCommand,

0 commit comments

Comments
 (0)