prompt-toolkit / prompt-toolkit/python-prompt-toolkit

Stdin is not a terminal

Open
#1,546 0 comments 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.