Python 3.4.1, pytest 2.6.2.
When a test fails, pytest
will routinely report what was printed to stdout by the test.
For instance this code:
From the documentation the behavior seems correct: only after the test function (test_result_and_stdout
) finishes the output streams will be restored, not after each readouterr
call. I don't think that currently capsys supports also redirecting to the original streams besides capturing them, which seems to be what you want.
I would suggest to create an issue in the official repository and see what people have to say.