prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.11k stars 717 forks source link

prompt-toolkit based apps (ipdb, ipython) don't work in tox 4 environment #1741

Open ziima opened 1 year ago

ziima commented 1 year ago

I discovered that apps based on prompt-toolkit don't work in tox 4 environment properly, initial report in https://github.com/tox-dev/tox/issues/2936

The bug doesn't seem to have any effect on tests themselves, only interactive session used within tox 4.

MWE

# Assuming py311 env has prompt_toolkit installed
tox exec --skip-pkg-install -e py311 -- python3

Simple prompt from documentation is not displayed correctly:

from prompt_toolkit import prompt

text = prompt('Give me some input: ')  # Clears screen, but nothing can be seen only a cursor on first line and correct column.
print('You said: %s' % text)

It seems there is an issue with flushing the screen, but I'm not sure on which part. In docs, I haven't found anything that would help me resolve the problem.