[WIP] Suspend capturing when stdin is being read (optionally)#4996
[WIP] Suspend capturing when stdin is being read (optionally)#4996blueyed wants to merge 7 commits intopytest-dev:featuresfrom
Conversation
|
I'd rather raise a helpful error message telling the user to use The capture code is already some of the more complex parts of pytest and adding more edges seems the wrong direction there |
Good point about a more helpful error message (I've created #5086 for it). (You should see the code that I have to make this work with But seriously, passing As for By now it works better to pass through
Agreed in general, but not being able to easily debug pytest's own tests does not help to improve this situation. (just some quick thoughts - happy to iterate from here) |
Maybe borrow from the pytest is currently lacking a good "capsys but for stdin", which (at least in my code) has led to some wacky hacks to patch out (spitballing) def test_stdin(capsys):
capsys.feed_input(b'foo\n')
assert input() == 'foo'
def test_stdin_not_fed(capsys):
with pytest.raises(...) as excinfo:
assert input() == 'foo'
msg, = excinfo.value.args
assert msg == 'idk some useful message about input but no provided input' |
|
Hi @blueyed, This has been on WIP for a long time now, and has some conflicts. I'm closing this for now to clear up our PR queue a bit, but please do re-open this when you have the time. Cheers! |
|
@nicoddemus |
Rejected in #4996. Conflicts: src/_pytest/capture.py testing/test_capture.py
|
Good idea, done. 👍 |
No description provided.