prompt-toolkit / prompt-toolkit/python-prompt-toolkit
Stdin is not a terminal
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
Hi!
I am trying to test my prompt using pytest and the fixture from the documentation:
@pytest.fixture(autouse=True, scope="function")
def mock_input():
pipe_input = create_pipe_input()
try:
with create_app_session(input=pipe_input, output=DummyOutput()):
yield pipe_input
finally:
pipe_input.close()
def test_gimme_setup(mock_input):
function_to_test("test")
mock_input.send_text("user.test\n")
mock_input.send_text("yes\n")
assert is_config("test")
When I run the test I get :
ERROR test_aws.py - io.UnsupportedOperation: Stdin is not a terminal.
I am using a mac with Zsh or Bash terminals.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the documented pytest fixture using create_pipe_input(), create_app_session(), and DummyOutput(), then reproduce the Stdin is not a terminal error. Trace which fixture or application entry point accesses stdin and confirm the test can send both inputs without raising the error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100