

@pytest.hookimpl(tryfirst=True, hookwrapper=True)
def pytest_runtest_makereport(item, call):
    outcome = (yield)
    rep = outcome.get_result()
    if ((rep.when == 'call') and rep.failed):
        if ('browser' in item.fixturenames):
            browser = item.funcargs['browser']
            for log_type in (set(browser.log_types) - {'har'}):
                data = '\n\n'.join(filter(None, (l.get('message') for l in browser.get_log(log_type))))
                if data:
                    rep.sections.append(('Captured {} log'.format(log_type), data))

dataset/ETHPy150Open pypa/warehouse/tests/conftest.py pytest_runtest_makereport/original