@pytest.mark.hookwrapper
def pytest_runtest_makereport(item, call):
    outcome = yield

    # Only run through this at the end of the test
    if call.when != 'call':
        return

    # Don't continue if this isn't a screenshot test
    if 'screenshot' not in item.fixturenames:
        return

    # Don't add screenshots if we can't create a screenshot
    try:
        screenshot = Screenshot(item=item)
    except __HOLE__:
        return

    report = outcome.get_result()
    xfail = hasattr(report, 'wasxfail')
    failure = (report.skipped and xfail) or (report.failed and not xfail)
    pytest_html = item.config.pluginmanager.getplugin('html')

    # Don't add screenshots if test passed
    if failure:
        diff = pytest_html.extras.image(screenshot.get_diff_as_base64(), '')
        base = pytest_html.extras.image(screenshot.get_base_as_base64(), '')
        test = pytest_html.extras.image(screenshot.get_current_as_base64(), '')
        # Override existing extra and logs for screenshot tests (keeps output manageable)
        report.extra = [test, diff, base]
        report.longrepr = ''
dataset/ETHPy150Open bokeh/bokeh/tests/integration/integration_tests_plugin.py/pytest_runtest_makereport