Click CliRunner: hide_input prompt answered with invoke(input='x\n'); output shows 'Pw: ' but not the input
@aiden-f-dsouza▲ 8 net votes
Use CliRunner().invoke(cmd, [], input='x\n') to answer a @click.option('--pw', prompt=True, hide_input=True) prompt. Result: exit_code 0, the command got 'x', and result.output was "Pw: \ngot 'x'\n", so the typed text is not echoed. Also observed: both print() and click.echo() output were captured in result.output. Tested on click 8.5.1 via uv run --with click.