Skip to content
Myr

testing/CliRunner: Fix regression related to EOF introduced in 262bdf0 (#2940)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Rowlando13 · committed by GitHub · parents 36deba8, e11a1ef · Browse files · 3 files+11 added−11 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+11 added−11 removed

  • tests:+2 added−2 removed
  • other:+9 added−9 removed

3 files+11 added−11 removed

modified:src/click/testing.py+8 added-9 removed
125 unmodified lines
126 @property127 def mode(self) -> str:128 return self._mode129130 def __next__(self) -> str: # type: ignore131 try:132 line = super().__next__()133 except StopIteration as e:134 raise EOFError() from e135 return line130137131def make_input_stream(132 input: str | bytes | t.IO[t.Any] | None, charset: str133) -> t.BinaryIO:134 # Is already an input stream.
216 unmodified lines
351352 @_pause_echo(echo_input) # type: ignore353 def visible_input(prompt: str | None = None) -> str:354 sys.stdout.write(prompt or "")355 try:362 val = next(text_input).rstrip("\r\n")356 val = next(text_input).rstrip("\r\n")357 except StopIteration as e:358 raise EOFError() from e359 sys.stdout.write(f"{val}\n")360 sys.stdout.flush()361 return val362363 @_pause_echo(echo_input) # type: ignore364 def hidden_input(prompt: str | None = None) -> str:365 sys.stdout.write(f"{prompt or ''}\n")366 sys.stdout.flush()367 try:371 return next(text_input).rstrip("\r\n")368 return next(text_input).rstrip("\r\n")369 except StopIteration as e:370 raise EOFError() from e371372 @_pause_echo(echo_input) # type: ignore373 def _getchar(echo: bool) -> str:374 char = sys.stdin.read(1)
203 unmodified lines
modified:tests/test_chain.py+2 added-2 removed
161 unmodified lines
162163 return processor164165 result = runner.invoke(cli, args, input=input)166 # last two lines are '' and 'Aborted!'167 assert result.output.splitlines()[:-2] == expect166 assert not result.exception167 assert result.output.splitlines() == expect168169170def test_args_and_chain(runner):171 @click.group(chain=True)
74 unmodified lines
modified:CHANGES.rst+1 added
22 unmodified lines
23- Fix handling of quoted and escaped parameters in Fish autocompletion. :issue:`2995` :pr:`3013`24- Lazily import ``shutil``. :pr:`3023`25- Properly forward exception information to resources registered with26 ``click.core.Context.with_resource()``. :issue:`2447` :pr:`3058`27- Fix regression related to EOF handling in CliRunner. :issue:`2939`:pr:`2940`2829Version 8.2.230-------------31
1262 unmodified lines