I use py.test message hooks (pytest_runtest_makereport () and pytest_report_teststatus ()).
When the py.test test failed, I can find the captured stdout data in the report header (in report.sections []).
When the py.test test passes, the report.sections [] list is empty.
Where can I find the captured stdout for a test that passes?
Thanks.
Edit: From the source (_pytest / capture.py), it looks like this is only available if the test fails:
def pytest_runtest_makereport(self, __multicall__, item, call): ... if not rep.passed: addouterr(rep, outerr)
source share