示例#1
0
def _assert_snapshot(example, url, example_type, diff):
    # Get setup datapoints

    screenshot_path, _, _ = get_example_pngs(example, diff)

    if example_type == 'notebook':
        wait = pytest.config.option.notebook_phantom_wait * 1000
        height = 2000
    else:
        wait = 1000
        height = 1000

    result = get_phantomjs_screenshot(url, screenshot_path, wait, height=height)

    status = result['status']
    errors = result['errors']
    messages = result['messages']
    resources = result['resources']

    if status != 'success':
        assert False, "PhantomJS did not succeed: %s | %s | %s" % (errors, messages, resources)
    else:
        if pytest.config.option.verbose:
            _print_phantomjs_output(result)
        assert True
示例#2
0
def _assert_snapshot(example, url, example_type):
    screenshot_path = example.img_path

    height = 2000 if example_type == 'notebook' else 1000
    wait = 30000

    start = time.time()
    result = get_phantomjs_screenshot(url, screenshot_path, 1000, wait, 1000, height)
    end = time.time()

    info("Example rendered in %s" % white("%.3fs" % (end - start)))

    success = result['success']
    timeout = result['timeout']
    errors = result['errors']
    resources = result['resources']

    no_errors = len(errors) == 0
    no_resources = len(resources) == 0

    if timeout:
        warn("%s: %s" % (red("TIMEOUT: "), "bokehjs did not finish in %s ms" % wait))

    if pytest.config.option.verbose:
        _print_phantomjs_output(result)

    assert success, "%s failed to load" % example.relpath
    assert no_resources, "%s failed with %d missing resources" % (example.relpath, len(resources))
    assert no_errors, "%s failed with %d errors" % (example.relpath, len(errors))
def _assert_snapshot(example, url, example_type):
    screenshot_path = example.img_path

    height = 2000 if example_type == 'notebook' else 1000
    wait = 30000

    start = time.time()
    result = get_phantomjs_screenshot(url, screenshot_path, 1000, wait, 1000,
                                      height)
    end = time.time()

    info("Example rendered in %s" % white("%.3fs" % (end - start)))

    success = result['success']
    timeout = result['timeout']
    errors = result['errors']
    resources = result['resources']

    no_errors = len(errors) == 0
    no_resources = len(resources) == 0

    if timeout:
        warn("%s: %s" %
             (red("TIMEOUT: "), "bokehjs did not finish in %s ms" % wait))

    if pytest.config.option.verbose:
        _print_phantomjs_output(result)

    assert success, "%s failed to load" % example.relpath
    assert no_resources, "%s failed with %d missing resources" % (
        example.relpath, len(resources))
    assert no_errors, "%s failed with %d errors" % (example.relpath,
                                                    len(errors))