Skip to content
Myr

Fixed up pausing tests and added doc information.

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

authored by Armin Ronacher · committed by Armin Ronacher · parent 04964ab · Browse files · 2 files+16 added−6 removed
This commit

State

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

Diff stats

2 files+16 added−6 removed

  • tests:+5 added−6 removed
  • other:+11 added−0 removed

2 files+16 added−6 removed

modified:click/termui.py+11 added
39 unmodified lines
4041 If the user aborts the input by sending a interrupt signal, this42 function will catch it and raise a :exc:`Abort` exception.4344 .. versionadded:: 4.045 Added the `err` parameter.4647 :param text: the text to show for the prompt.48 :param default: the default value to use if no input happens. If this49 is not given it will prompt until it's aborted.50 :param hide_input: if this is set to true then the input value will
57 unmodified lines
108109 If the user aborts the input by sending a interrupt signal this110 function will catch it and raise a :exc:`Abort` exception.111112 .. versionadded:: 4.0113 Added the `err` parameter.114115 :param text: the question to ask.116 :param default: the default for the prompt.117 :param abort: if this is set to `True` a negative answer aborts the118 exception by raising :exc:`Abort`.
377 unmodified lines
496 will instead do nothing.497498 .. versionadded:: 2.0499500 .. versionadded:: 4.0501 Added the `err` parameter.502503 :param info: the info string to print before pausing.504 :param err: if set to message goes to ``stderr`` instead of505 ``stdout``, the same as with echo.506 """507 if not isatty(sys.stdin) or not isatty(sys.stdout):508 return509 try:
9 unmodified lines
modified:tests/test_utils.py+5 added-6 removed
192 unmodified lines
193 out, err = capfd.readouterr()194 assert out == ''195 assert err == 'Prompt to stderr [y/N]: '196197 monkeypatch.setattr(click._compat, 'isatty', lambda x: True)197 monkeypatch.setattr(click.termui, 'isatty', lambda x: True)198 monkeypatch.setattr(click.termui, 'getchar', lambda: ' ')199199 emulate_input(' ')200 click.pause('Pause to stdin')200 click.pause('Pause to stdout')201 out, err = capfd.readouterr()202 assert out == 'Pause to stdin'202 assert out == 'Pause to stdout\n'203 assert err == ''204205 emulate_input(' ')205 click.pause('Pause to stderr', err=True)206 out, err = capfd.readouterr()207 assert out == ''209 assert err == 'Pause to stderr'208 assert err == 'Pause to stderr\n'209210211def test_open_file(runner):212 with runner.isolated_filesystem():
17 unmodified lines