python pytest occasionally fails with OSError: reading from stdin while output is captured
Since input()
is an interactive function, you'll want to mock out the return value in your automated tests. Something like this:
def test_prompt(capsys, monkeypatch):
monkeypatch.setattr('path.to.yourmodule.input', lambda: 'no')
val = prompt_to_activate(bear=..., printer=...)
assert not val