def test_notebook_error(): path = os.path.join(get_notebook_dir(), 'test-notebook-error.ipynb') assert os.path.isfile(path) try: update_notebook_by_run(path) except ValueError: pass assert check_notebook_error_and_changed(path) == (True, False) touch(path) assert check_notebook_error_and_changed(path) == (True, True) from wzdat import rundb redis_ri = rundb.get_run_info(path) rundb.remove_run_info(path) manifest_ri = get_run_info(path) # both elapsed time is equal assert redis_ri[1] == manifest_ri[1] # both error msg is equal assert redis_ri[-1] == manifest_ri[-1]
def _collect_gnbs(gnbs, gk, groups): nbs = [] nbdir = get_notebook_dir() logging.debug('_collect_gnbs ' + nbdir) # logging.debug(str(groups[gk])) for path, url, fname in groups[gk]: out = notebook_outputs_to_html(path) ri = get_run_info(path) logging.debug('get_run_info {}'.format(ri)) if ri is not None: start, elapsed = _get_run_time(ri) cur = ri[2] total = ri[3] err = ri[4].decode('utf8') if err != 'None': out = '<div class="fail-result">Check error, fix it, '\ 'and rerun.</div>' # logging.debug(u'err {}'.format(err)) ri = (start, elapsed, cur, total, err) path = path.replace(nbdir, '')[1:] nbs.append((url, fname, out, ri, path)) gnbs.append((gk, nbs)) logging.debug('_collect_gnbs done')
def test_common_runinfo(): path = os.path.join(get_notebook_dir(), 'test-notebook.ipynb') rundb.remove_run_info(path) ri = get_run_info(path) assert len(ri) == 5