prompt_toolkit create_pipe_input API changed
3.0.29: 2022-04-04
------------------
Breaking changes:
- The following are now context managers:
`create_pipe_input`, `PosixPipeInput` and `Win32PipeInput`.
_______________________________ test_shell_exit ________________________________
text = '\x04y', check_line_ending = False, local_locals = {}
local_globals = None, timeout = 10
def _feed_cli_with_input(
text, check_line_ending=True, local_locals=None, local_globals=None, timeout=10
):
"""
Create a Prompt, feed it with the given user input and return the CLI
object.
Inspired by python-prompt-toolkit/tests/test_cli.py
"""
# If the given text doesn't end with a newline, the interface won't finish.
if check_line_ending:
assert text.endswith("\r")
inp = create_pipe_input()
if local_locals is None:
local_locals = {}
def mylocals():
return local_locals
if local_globals:
def myglobals():
return local_globals
else:
myglobals = None
try:
> inp.send_text(text)
E AttributeError: '_GeneratorContextManager' object has no attribute 'send_text'
tests/shell/test_bliss_shell_basics.py:73: AttributeError
During handling of the above exception, another exception occurred:
def test_shell_exit():
try:
> _feed_cli_with_input(chr(0x4) + "y", check_line_ending=False)
tests/shell/test_bliss_shell_basics.py:115:
Edited by Wout De Nolf