Use TestRun.makereport()

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga
2019-11-29 10:55:47 +01:00
parent 263f3137da
commit a53846953c
2 changed files with 2 additions and 11 deletions

View File

@@ -97,16 +97,7 @@ def pytest_runtest_setup(item):
@pytest.hookimpl(tryfirst=True, hookwrapper=True) @pytest.hookimpl(tryfirst=True, hookwrapper=True)
def pytest_runtest_makereport(item, call): def pytest_runtest_makereport(item, call):
res = (yield).get_result() res = (yield).get_result()
TestRun.makereport(item, call, res)
TestRun.outcome = res.outcome
from _pytest.outcomes import Failed
if res.when == "call" and res.failed:
msg = f"{call.excinfo.type.__name__}: {call.excinfo.value}"
if call.excinfo.type is Failed:
TestRun.LOGGER.error(msg)
else:
TestRun.LOGGER.exception(msg)
def pytest_runtest_teardown(): def pytest_runtest_teardown():