예제 #1
0
def _print_phantomjs_output(result):
    errors = result['errors']
    messages = result['messages']
    resources = result['resources']

    for message in messages:
        msg = message['msg']
        line = message.get('line')
        source = message.get('source')

        if source is None:
            write(msg)
        elif line is None:
            write("%s: %s" % (source, msg))
        else:
            write("%s:%s: %s" % (source, line, msg))

    # Process resources
    for resource in resources:
        url = resource['url']
        if url.endswith(".png"):
            ok("%s: %s (%s)" % (url, yellow(resource['status']), resource['statusText']))
        else:
            warn("Resource error:: %s: %s (%s)" % (url, red(resource['status']), resource['statusText']))

    # You can have a successful test, and still have errors reported, so not failing here.
    for error in errors:
        warn("%s: %s" % (red("PhatomJS Error: "), error['msg']))
        for item in error['trace']:
            write("    %s: %d" % (item['file'], item['line']))
예제 #2
0
파일: utils.py 프로젝트: 0-T-0/bokeh
def upload_example_pngs_to_s3(diff):

    all_examples = get_all_examples()
    for example, _ in all_examples:
        example_path = relpath(no_ext(example), example_dir)
        s3_path = join(__version__, example_path)
        test_png, _, diff_png = get_example_pngs(example, diff)
        if test_png:
            if isfile(test_png):
                s3_png_file = s3_path + ".png"
                write("%s Uploading image to S3 to %s" % (green(">>>"), s3_png_file))
                upload_file_to_s3(test_png, s3_png_file, "image/png")
        if diff_png:
            if isfile(diff_png):
                s3_png_file = s3_path + diff + "-diff.png"
                write("%s Uploading image to S3 to %s" % (green(">>>"), s3_png_file))
                upload_file_to_s3(diff_png, s3_png_file, "image/png")