-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[WIP] Suspend capturing when stdin is being read (optionally) #4996
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.