(This is meant as a much more specific version of How can I make py.test tests accept interactive input?).
I'm using py.test, and I'm trying to make stdin and stdout work as normally -- i.e. print() should immediately print to the terminal, and input() (this is Python 3.5) should accept a line of input interactively.
(I am trying to make my test cases do this, I know this isn't normal for unit testing, I am not trying to have my testcases test something else that uses stdin and stdout).
Running pytest with the -s flag does pretty much what I want, but I would rather have this as an option set within my test modules or individual test functions. Especially as I only want to use it on some tests. capsys.disabled() as context manager doesn't cut it -- it only deals with stdout and stderr, not stdin.
Is there a way to do this, either a pytest option to call via marker/decorator/context manager, or a way to "re-connect" sys.stdin/stdout within my module?
Thank you.