4
我正在使用py.test報告鉤子(pytest_runtest_makereport()和pytest_report_teststatus())。我在哪裏可以找到捕獲的stdout的py.test測試通過?
當py.test測試失敗時,我可以在報告鉤子(在report.sections [])中找到捕獲的stdout數據。
當py.test測試通過時,report.sections []列表爲空。
我在哪裏可以找到通過測試的捕獲標準輸出?
謝謝。
編輯:從源(_pytest/capture.py),它看起來像這樣僅當測試不及格:
def pytest_runtest_makereport(self, __multicall__, item, call):
...
if not rep.passed:
addouterr(rep, outerr)