

def _get_pdiff(example, diff):
    (test_png, ref_png, diff_png) = get_example_pngs(ref_png_path, diff)
    info(('generated image: ' + test_png))
    retrieved_reference_image = _get_reference_image_from_s3(example, diff)
    if retrieved_reference_image:
        ref_png_path = dirname(ref_png)
        if (not exists(ref_png_path)):
            os.makedirs(ref_png_path)
        with open(ref_png, 'wb') as f:
            f.write(retrieved_reference_image)
        info(('saved reference: ' + ref_png))
        code = process_image_diff(diff_png, test_png, ref_png)
        if (code != 0):
            warn('generated and reference images differ')
            warn(('diff: ' + diff_png))
        else:
            ok('generated and reference images match')

dataset/ETHPy150Open bokeh/bokeh/tests/examples/test_examples.py _get_pdiff/VarMisuse@22/35 `example`->`ref_png_path`