Esempio n. 1
0
 def _get_notebook_node(self):  # pragma: no cover
     "Load captured notebook node"
     self._notebook_data.seek(0, os.SEEK_END)
     size = self._notebook_data.tell()
     if size == 0:
         raise Exception("Captured buffer size for notebook node is zero.")
     self._notebook_data.seek(0)
     node = reader.reads(self._notebook_data.read())
     self.nbversion = reader.get_version(node)
     self._notebook_data.close()
     return node
Esempio n. 2
0
 def _get_notebook_node(self):                   # pragma: no cover
     "Load captured notebook node"
     self._notebook_data.seek(0, os.SEEK_END)
     size = self._notebook_data.tell()
     if size == 0:
         raise Exception("Captured buffer size for notebook node is zero.")
     self._notebook_data.seek(0)
     node = reader.reads(self._notebook_data.read())
     self.nbversion = reader.get_version(node)
     self._notebook_data.close()
     return node
Esempio n. 3
0
 def _readnb(self, filename):
     with open(filename) as f:
         return reads(f.read())
    tv = IPyTestConsole()

    if args.strict:
        tv.default_results['diff'] = False

    if args.no_timeout:
        tv.default_results['timeout'] = False

    tv.writeln('testing ipython notebook : "%s"' % ipynb)
    tv.fold_open('ipynb')

    timeout_rerun = args.rerun
    fail_restart = args.restart

    with open(ipynb) as f:
        nb = reads(f.read())
        # Convert all notebooks to the format IPython 3.0.0 uses to
        # simplify comparison
        nb = IPython.nbformat.convert(nb, 4)

    notebook_restart = True
    notebook_run_count = 0

    while (notebook_restart):
        notebook_restart = False
        notebook_run_count += 1

        tv.reset()
        tv.write("starting kernel ... ")
        with IPyKernel() as ipy:
            ipy.default_timeout = args.timeout
Esempio n. 5
0
    tv = IPyTestConsole()

    if args.strict:
        tv.default_results['diff'] = False

    if args.no_timeout:
        tv.default_results['timeout'] = False

    tv.writeln('testing ipython notebook : "%s"' % ipynb)
    tv.fold_open('ipynb')

    timeout_rerun = args.rerun
    fail_restart = args.restart

    with open(ipynb) as f:
        nb = reads(f.read())
        # Convert all notebooks to the format IPython 3.0.0 uses to
        # simplify comparison
        nb = IPython.nbformat.convert(nb, 4)

    notebook_restart = True
    notebook_run_count = 0

    while (notebook_restart):
        notebook_restart = False
        notebook_run_count += 1

        tv.reset()
        tv.write("starting kernel ... ")
        with IPyKernel() as ipy:
            ipy.default_timeout = args.timeout