Skip to content

unable to read from stdin when using cpython 3.13 #13170

Closed
@15r10nk

Description

@15r10nk
  • a detailed description of the bug or problem you are having
  • output of pip list from the virtual environment you are using
  • pytest and operating system versions
  • minimal example if possible

I ask the user in inline-snapshot for approval if he wants to fix the snapshot values, but this does not work for cpython 3.13.
I can only reproduce this problem with pytest.

The problem can be reproduced like this:

conftest.py

def pytest_terminal_summary(config):

    capture = config.pluginmanager.getplugin("capturemanager")

    capture.suspend_global_capture(in_=True)

    print("Enter 'hi'")
    value = input()
    print()
    print("value:",repr(value))
    assert value == "hi"


    capture.resume_global_capture()

test_example.py

def example():
    print("unimportant example")

Running pytest asks for "hi" but value will always be an empty string no matter what you type.

But it work when you use pytest -s and type "hi" or echo hi | pytest.

I can only reproduce this problem using cpython 3.13, it worked for older versions.

uv pip list:

Package   Version
--------- -------
iniconfig 2.0.0
packaging 24.2
pluggy    1.5.0
pytest    8.3.4

os: linux/debian

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions